revCopyFolder and long file names
Ken Ray
kray at sonsothunder.com
Mon May 21 18:59:10 EDT 2007
On Thu, 17 May 2007 11:38:03 +0100, Ian Wood wrote:
> On 17 May 2007, at 11:35, Ian Wood wrote:
>
>> If either the original folder or destination folder names contain >
>> 32 chars, revCopyFolder fails with 'execution error'.
>
> P.S. Does anyone have a workaround for this? Other than forking the
> code and using AppleScript/terminal commands on OS X...
Actually the 'revCopyFolder' command uses AppleScript under the hood to
do its business, and this is why you get an 'execution error'. The
problem is that Rev doesn't maintain the long file name as it is, but
in its "hashed" state. This is something Rev can work with and not have
a problem with (which was the bugs that were fixed). The problem is
that when the hashed path is put into an AppleScript statement,
AppleScript chokes. So I'd suggest using my handy-dandy
"stsLongFilePath" function:
function stsLongFilePath pPath
switch (the platform)
case "MacOS" -- assumes OS X
put "set tPath to" && quote & pPath & quote & cr & \
"set tPath to (POSIX file tPath) as string" & cr & \
"POSIX path of tPath" into tScript
do tScript as "AppleScript"
return (char 2 to -2 of the result) -- strips quotes
break
case "Win32"
return the longFilePath of pPath
break
end switch
end stsLongFilePath
So you can then do:
revCopyFolder stsLongFilePath(tSrc),stsLongFilePath(tDest)
And all should be well... :-)
Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list