LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Is anybody able to tell me why the code below works when run in the IDE but not when running as a standalone under Mac OSX. The script creates the folders but the file and folder are not copied using revCopyFile and revCopyFolder.
global gdefaultFolder
on mouseUp
if fld 1 is empty then exit mouseUp
answer folder "Select a folder in which to build the presentation"
if it is empty then exit mouseUp
set the defaultFolder to it
put it into theFolderPath
put line 1 of fld 1 into theFolderName
create folder theFolderName
create folder theFolderName & "/BernierResources"
create folder theFolderName & "/BernierResources/capitons"
create folder theFolderName & "/BernierResources/cercueils"
create folder theFolderName & "/BernierResources/cercueilsCroix"
create folder theFolderName & "/BernierResources/cercueilsEnfant"
create folder theFolderName & "/BernierResources/emblemes"
create folder theFolderName & "/BernierResources/urnes"
revCopyFile (gdefaultFolder & "/Bernier Master.rev"), (theFolderPath & "/" & theFolderName)
revCopyFolder (gdefaultFolder & "/BernierResources/BernierData"), theFolderPath & "/" & theFolderName & "/BernierResources"
rename (theFolderPath & "/" & theFolderName & "/Bernier Master.rev") to (theFolderPath & "/" & theFolderName & "/Presentation.rev")
put empty into fld 1
--open stack (theFolderPath & "/" & theFolderName & "/Presentation.rev")
end mouseUp
tell application "Finder"
set theSourceFile to POSIX file (do shell script "echo " & "#fileToCopy#") as alias
set theDestinationFolder to POSIX file (do shell script "echo " & "#destinationPath#") as alias
duplicate file theSourceFile to folder theDestinationFolder replacing true
end tell
I put the above code in a hidden field. These contents I put into a variable in my RunRev script (e.g. appleScriptInit) and substitute my placeholders #fileToCopy# and #destinationPath# with the appropriate values in a RunRev script, then execute a
The conclusion that revCopyFile does not work in OS X is not supported by what I see here.
A one button application that runs a simple script with "answer file to copy", "answer destination directory" and "revCopyFile selectedfile,selectedDestination" works in both the IDE and as a standalone in 10.6.3. The standalone works in 10.6.3 whether the app is produced in OS X or in Linux.
A similar simple app which creates the destination directory instead of selecting an already existing one also works as expected.
An app made to select and then copy a file into [theApp.app]/Contents/MacOS directory of the standalone, using effective filename of this stack, etc. syntax, also successfully copies to this location for me.
With all due respect, is it not possible that you are having trouble with filepath names? Are the files and folders you're copying actually where you're telling the script to look, both working with the stack in the IDE and after you've made the standalone? Are all the various created pathnames correct; no extra slashes or misplaced quotes? Perhaps adding some mechanism to show the pathnames of all files and directories at each step of the operation, and whether or not the files to be copied are actually found in their specified locations at the time of the operation, would reveal such problems.
(edit -- I apologize for cross-posting this. It was inadvertent. There has been some cross-posting of this topic as well as some cross-referencing to another thread, which is where I had originally intended to post this. Tabbed browsing... If it's ok with the mods, it might be useful to allow it stay here, too, though, because it is relevant to the topic.)
This was using the exact same files, and the exact same folders, correct path names, correct file names. The alternate solution suggested by another poster worked perfectly using the Apple Script that he supplied. I wish I could better narrow down this issue, but the bottom line is this, it works in the IDE but does not work in a stand alone application and I'm not the only one who has reported this issue. There is obviously a problem going on with the revCopyFile which is causing this bug to occur. I'd love to lay blame on something as simple as an extra quote or misspelled file name but this is simply not the case.
The code you sent works like a charm both in Stand Alone as well as in the IDE. My code is still not working in stand alone, which leads me to think that I am missing a dependency. Since I am using a third party tree stack in my application I had to turn off the "Search for required inclusions" option (according to their instructions). Although I did select every library that logically looked like my application uses. Do you have any idea what library file the revCopyFile command is located in?
The revCopyFile is in the common library... I have sent you another stack that uses a 3rd party library, revCopyFile still works from the IDE and again if you compile it as a standalone..
Thank you again Dixie, my only thought on all this is that it must be related to the fact that I'm trying to copy files from my DropBox folder. DropBox actually caused me another problem relating to deployment so I'm thinking that this might be the culprit. It just makes no sense to me that it works in the IDE but the same exact files won't copy in the stand alone, so my only thoughts are that it relates to the environment. If I do discover anything else I will definitely update this thread.