Problem with RevCopyFile

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Problem with RevCopyFile

Post by Dixie » Mon Jun 14, 2010 7:49 am

Good morning...

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.

Code: Select all

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
Any help would be appreciated...

Be well

Dixie

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Problem with RevCopyFile

Post by exheusden » Fri Dec 24, 2010 2:08 pm

Dixie, did you ever get revCopyFile and revCopyFolder to work correctly?

I, too, am using MacOS X and revCopyFile copies nothing; revCopyFolder, on the other hand, copies the folder, but not its contents.

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Mon Dec 27, 2010 6:45 am

I'm having the exact same problem with revCopyFile on OS/X. Works in IDE but gives an error when running stand alone. Any ideas?

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Problem with RevCopyFile

Post by WaltBrown » Mon Dec 27, 2010 7:36 am

In the original post, Dixie, you use "gdefaultfolder" but don't set it anywhere. Could that be an issue?
Walt
Walt Brown
Omnis traductor traditor

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Problem with RevCopyFile

Post by exheusden » Mon Dec 27, 2010 11:04 am

After much testing, I gave up on RevCopyFile and looked for another solution. I finally achieved what I wanted with AppleScript:

Code: Select all

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

Code: Select all

 do appleScriptInit as "applescript"
It works fine.

I do much the same for folders, with just a slight modification to the Apple Script code.

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Mon Dec 27, 2010 7:48 pm

Thank you Exheusden! Your solution is perfect and it solved my problem.

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Problem with RevCopyFile

Post by exheusden » Mon Dec 27, 2010 9:34 pm

Glad to have been of some help, interactbooks.

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: Problem with RevCopyFile

Post by wsamples » Tue Dec 28, 2010 6:52 pm

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.)

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Wed Dec 29, 2010 4:56 am

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.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Problem with RevCopyFile

Post by Dixie » Wed Dec 29, 2010 12:43 pm

Interactbooks...

I don't think that there is any problem with revCopyFile. I have attached a stack that works both in the IDE and as a standalone if you compile it...

be well

Dixie
Attachments
CopyStack.zip
(1.83 KiB) Downloaded 336 times

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Wed Dec 29, 2010 10:41 pm

Thank you Dixie, I will test it and get back to you.

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Wed Dec 29, 2010 11:09 pm

Dixie,

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?

Thanks again for your support.

Regards,

Ezra

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Problem with RevCopyFile

Post by jmburnod » Wed Dec 29, 2010 11:33 pm

Hi All,

I tested the Dixies copystack.rev. It work well for me as stand alone

Tested with :
powerbook G4 OSX 10.4.2
iMac intel core duo OSX 10.5.6

All the best

Jean-Marc
https://alternatic.ch

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Problem with RevCopyFile

Post by Dixie » Sat Jan 01, 2011 1:06 pm

Ezra...

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..

be well

Dixie
Attachments
copy & 3rdPartyLib.zip
(90.12 KiB) Downloaded 302 times

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Problem with RevCopyFile

Post by interactbooks » Sat Jan 01, 2011 4:23 pm

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.

Post Reply