Is Binfile broken?

Richard Gaskin ambassador at fourthworld.com
Tue Sep 30 16:26:18 EDT 2014


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
  ____________________________________________________________________
  Ambassador at 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




More information about the use-livecode mailing list