Le 2 nov. 06 à 15:47 Soir, Rubber Chicken Software Co. a écrit:
Also, I always thought MoveFileTo didn't work to move a non empty
folder (only a file or an empty folder, like the Delete and
CopyFileTo methods). I wonder if that means you can't do this in
Panther while you may do it in Tiger. If that's the problem, then you
have to copy every item (starting with folders and then with files).
The real question is what the RB CopyFileTo method is really
capable of. Apparently the internal calls that RB makes are Tiger-
dependent for that type of operation. So perhaps there's another
way to do it, perhaps with a Finder call with a AppleEvent/Script?
I don't know how to do this.
As far as I know, REALbasic uses OS runtimes to perform its
operations. If the copy part has changed in Tiger, since Panther,
then that can explain the problem.
To copy a file, you can also try:
an AppleEvent to the "Finder" (The Finder must be running, which is
almost the case; better than an AppleScript since scripts in RB do
not accept folderitems):
dim ae As AppleEvent
ae=newAppleEvent("core","clon","MACS")
ae.folderitemParam("----")=SourceFile
ae.folderitemParam("insh")=DestinationFolder
ae.BooleanParam("alrp")=true 'This force replacing; remove it to show
a message in the Finder saying "An item with that name already
exists. Do you want to replace it?"
if not ae.send then
msgBox "Well, the Finder is not running."
end if
an apple script (the Finder must also be running and you have to pass
parameters as text; I recommend passing a posix path rather than an
absolute path since more than one file can have the same absolute path):
on run {File,Destination}
set item1 to File as alias
set item2 to Destination as alias
try
tell application "Finder"
duplicate item1 to item2
end tell
on error etxt number enum
return enum as text
end
return "0"
end
a shell command (not available for MacOS classic):
MyShell.Write "cp "+SourceFile.shellpath+" "+DestinationFolder.shellpath
Note that I didn't tested for syntax errors, I wrote that from
scratch and you may have to change a syntax error, maybe.
HTH_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>