How to copy a file so it creates missing folders in the path

tbodine lvhdgc7 at gmail.com
Thu May 9 19:39:02 EDT 2013


Hi,

I'm working on a Win/Mac application and trying to copy a Preferences stack
from the defaultFolder to Application Data with a unique folder there to
house it. I build a path, including the folder name, but revCopyFile
silently fails every time. If I remove the desired folder from the path, it
works but leaves my file loose in the top level App Data folder. Is there a
way to do this that creates any missing folders in the path?

My code is:

 if gOS contains "Mac" then
    put specialFolderPath("asup") into tPath
 else
   put specialFolderPath(26) into tPath
end if
put tPath & "/MyFolder/Settings.rev" into gSettingsPath

put "CustomSettings.rev" into tSourceFile
revCopyFile tSourceFile, gSettingsPath

When I have the folder name in the path, this fails. If I remove it, it
works. (I'm also changing the name of the stack file during the copy
process, but don't think that matters.)

Thanks!
Tom Bodine




--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/How-to-copy-a-file-so-it-creates-missing-folders-in-the-path-tp4664628.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list