[futurebasic] Re: [FB] Copying a file from a packaged app's resources directory

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Bernie <fblist.bw@...>
Date: Wed, 2 Jan 2008 09:29:29 +0100
Robert P wrote:

>
> Bernie wrote:
>
>> Does anyone have some code to share that will copy a file from the  
>> packaged app's resources directory to another directory. I don't  
>> want to spend too much time on this, so any help appreciated. BTW,  
>> the app will never be translated via FBtoC.
>
> You could adapt this:
>
> // arguments must be shell-escaped UTF-8
> local fn CopyFileUnix( fileName as Str255, pathToSrcDir as Str255,  
> pathToDestDir as Str255 )
> '~'1
> dim as Str255 cmd, s
>
> cmd = "cp -p -f " + pathToSrcDir + "/" + fileName + " " +  
> pathToDestDir
> open "UNIX", 222, cmd
> while ( eof( 222 ) == _false )
> line input #22, s
> // print s
> wend
> end fn


I pinched a couple functions from another app: EscapeBadPathCharacters 
$, PathForUNIX$ to go with the above and all is working well.

Thanks.

Bernie