revCopyFolder in LC Server
matthias_livecode_150811 at m-r-d.de
matthias_livecode_150811 at m-r-d.de
Wed Jan 27 07:26:23 EST 2021
Neville,
revCopyFolder is part of the revCommonLibary which is located in the folder Tools/Toolset/libraries within the LivecodeIDE app bundle (MacOS) or program folder (Windows).
The file revCommonLibrary.livecodescript is not included in the LivecodeServer Installation files by default.
You could either copy that library into your LivecodeServer folder on your webserver and make use of the complete library or you just use that part that is needed and include that in your LivecodeServer script.
This is the complete revCopyFolder Handler from the common library
on revCopyFolder pSrcFolder, pDestFolder
if the last char of pSrcFolder is "/" then delete the last char of pSrcFolder
if the platform is "MacOS" then
if "applescript" is in the alternateLanguages then
if there is not a folder pDestFolder then
create folder pDestFolder
end if
do revAppleScriptFull("copyFolder",pSrcFolder,pDestFolder) as "applescript"
if word 1 of the result is "folder" then
#Copy successful so don't return anything
return empty
else
return the result
end if
else return "Error: AppleScript not installed"
else if the platform is "Win32" then
revSetWindowsShellCommand
if there is a directory pDestFolder then
set the itemDel to "/"
if char -1 of pDestFolder is "/" then delete char -1 of pDestFolder
local tLastItemOfSrcFolder
put item -1 of pSrcFolder into tLastItemofSrcFolder
put "/" & tLastItemofSrcFolder after pDestFolder
create directory pDestFolder
end if
# TH-2008-03-11 : Fix for 5465, should remedy problem with copy sometimes crashing on vista
# now use robocopy instead of xcopy if operating under vista.
if the systemVersion is "NT 6.0" then
get shell ("robocopy" && revWindowsFromUnixPath(quote&pSrcFolder"e) && revWindowsFromUnixPath(quote&pDestFolder"e) && "/E /NFL /NDL /NS /NC /NJH /NJS")
else
get shell ("xcopy /I /E /Y /R" && revWindowsFromUnixPath(quote&pSrcFolder"e) && revWindowsFromUnixPath(quote&pDestFolder"e))
end if
else
get shell ("cp -rf" && quote&pSrcFolder"e && quote&pDestFolder"e)
end if
return the result
end revCopyFolder
Regards,
-
Matthias Rebbe
Life Is Too Short For Boring Code
> Am 27.01.2021 um 13:02 schrieb Neville Smythe via use-livecode <use-livecode at lists.runrev.com>:
>
> I get a “Can’t find handler (revCopyFolder)” error in LC Server from a script line
> revCopyFolder tTemplateDir,tDirPath
>
> The script works up to that line. Is there a problem with using revCopyFolder in LCServer?
>
> Neville
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list