It's curious that sysError is returning 0 when the error occurs.

You might also check if the paths exist - maybe something got amiss in loading the params to that handler?

Another option might be to use rsync via LC's shell function instead of rolling your own. It's not available for Windows, but for OS X and Linux it's super-efficient for mirroring folders.

If nothing else, if you run rsync in Terminal its diagnostics should tell you if your paths are amiss, so if may be useful if only to debug this issue.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com



Is Binfile broken?
Bob Sneidar bobsneidar at iotecdigital.com
Tue Sep 30 21:49:20 CEST 2014

    Previous message: Is Binfile broken?
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

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

_______________________________________________
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

Reply via email to