View Full Version : test if path is valid?

3rd Dimentia
05 May 2008, 03:50 PM
I'm writing a script that will assign maps read from an IFL to slots in a multisub material. I'd like to be able to test if the paths are valid as I read them from the file. Is this possible?

Also, while I'm at it, is this the best way to read a bunch of bitmap paths from a file to an array?

iflFile = openFile IFLname
mapList = #()
while not eof iflFile do
append maplist (readline iflFile)


05 May 2008, 03:58 PM
Use the inbuilt Max Function DoesFileExist()

05 May 2008, 04:50 PM
And here's a function that will check for a valid folder:

fn doesFolderExist f create:false =
local val
val = if (doesFileExist f) and (getfileattribute f #directory) then true else false
if not val and create then
val = makeDir f

Set 'create' to true to make the folder if it doesn't exist.

05 May 2008, 05:49 PM
or kick it Dotnet style...

((dotnetclass "System.IO.Directory").exists "D:\\temp")
((dotnetclass "System.IO.File").exists "D:\\temp\\")

each return true or false, depending on... well U know...

3rd Dimentia
05 May 2008, 05:50 PM
Exactly what I was lookng for. Thanks guys.


CGTalk Moderation
05 May 2008, 05:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.