Klaus' raw materials are helpful, but I'm lazy and this comes up a lot
for me so I wrote a function to take care of it for any number of levels
in the path - from the old stdLib project:
--
-- stdEnsurePath
--
-- Checks the path specified in pPath to make sure each of its
-- directories exists, creating any that need to be as it goes.
--
on stdEnsurePath pPath
set the itemdel to "/"
--
put item 1 of pPath into tTestPath
put pPath into tDestFolders
delete item 1 of tDestFolders
repeat for each item tFolder in tDestFolders
put "/"&tFolder after tTestPath
if there is not a folder tTestPath then
create folder tTestPath
Err the result, "Couldn't create folder ""e&tTestPath"e
end if
end repeat
end stdEnsurePath
--
-- ERR
--
-- Simple method for checking and reporting errors to the user.
-- Most useful to call for those circumstances where you would
-- check the result and display it if it contains an error.
-- By default, it exits to top, but you can pass any value
-- in the optional third param to prevent this exit.
--
on Err pResultStr, pErrMessage, pNoExitFlag
if pResultStr is not empty then
if pErrMessage is empty then answer pResultStr
else answer pErrMessage
if "appProgress" is in the windows then
close stack "appProgress"
end if
if pNoExitflag is empty then exit to top
end if
end Err
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode