For creation of a folder the sys error() returned 0. Following is the actual handler in full.
on syncFiles theSourceFiles, theDestFiles if the last char of theDestPath is "/" then delete the last char of theDestPath set the itemDelimiter to "/" repeat for each line theSourceFile in theSourceFiles put theSourceFile into theDestFile replace theSourcePath with theDestPath in theDestFile if not there is a file theDestFile then open file theSourceFile for binary read put the result into theError read from file theSourceFile until eof close file theSourceFile put it into theSourceData put item 1 to -2 of theDestFile & "/" into theCurrentPath if not there is a folder theCurrentPath then create folder theCurrentPath put the result into theError if theError is not empty then put syserror() answer error "Cannot create directory. Check permissions." as sheet close file theSourceFile exit syncFiles end if end if open file theDestFile for binary write put the result into theError if theError is not empty then put syserror() answer error "Cannot write to this directory. Check the file path and permissions." as sheet close file theDestFile exit syncFiles end if write theSourceData to file theDestFile close file theDestFile end if end repeat end syncFiles Bob S On Sep 30, 2014, at 10:47 , Richard Gaskin <ambassa...@fourthworld.com> wrote: > Bob Sneidar wrote: > >> On Sep 30, 2014, at 09:13 , Richard Gaskin wrote: >>> To diagnose problems with file access (and many other circumstances >>> where error-checking is useful), check the result after attempting >>> the action. With file access it can be very help to include a call >>> to sysError there, so you can see what the OS is complaining about, >>> .e.g: >>> open file theDestFile for binary write >>> if the result is not empty then >>> answer the result &"("& sysError() &")" >>> end if >> Thanks Richard. I get “Can’t open that file.” in the result for the >> write. Very informative. ;-) >> Now I have to figure out *why* it can’t open that file. > > What was the OS error number returned from sysError()? > > -- > Richard Gaskin > Fourth World Systems > 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 _______________________________________________ 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