Copy An Application Without "revcopy"

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Copy An Application Without "revcopy"

Post by johnmiller1950 » Wed Mar 12, 2008 4:32 pm

Greetings Again,

OK! I'm making an installer that has a progress bar. I have to copy both an application file and a number of other data files to the Documents folder. When I use "revcopy" the system throws up the system progress bar which looks weird.

Is there a way to copy an application without using "revcopy"

Thanks!
John Miller

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Mar 30, 2008 2:17 pm

Hi John,

You can recursively read all file from a folder and its subfolders and write them to a new location. You would have to check the file an creator types and you might need to take resource forks into account.

You might also use the shell (cp or mv?) to copy files.

I think there are a few examples in this forum or on the Rev Use List.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Mon Mar 31, 2008 12:13 pm

If you go for the custom installer, make sure to get the entire file in binary format - and if you're working on a Mac, you may also have to copy the 'resfile' part of the file, just to be sure. Revolution stacks make excellent archives for this soprt of thing.

Basically, you can 'import' a file using the following script:

Code: Select all

on ImportPackageFile pIdentifier, pInputPath
  set the uBinFile[pIdentifier] of this stack to compress(URL ("binfile:" & pInputPath))
  put URL ("resfile:" & pInputPath) into tResFork
  if tResFork is not empty then
    set the uResFile[pIdentifier] of this stack to compress(tResFork)
  end if
end ImportPackageFile
And then you can 'export' that file using the folloowing script:

Code: Select all

on ExportPackageFile pIdentifier, pOutputPath
  put decompress(the uBinFile[pIdentifier] of this stack) into URL ("binfile:" & pOutputPath)
  put the uResFile[pIdentifier] of this stack into tResFork
  if tResFork is not empty then
    put decompress(tResFork) into URL ("resfile:" & pOutputPath)
  end if
end ExportPackageFile
Looping over all the files to import/export them using this apckage, is left as an exercise to the reader :-)

The downside of this approach, is that the creation and modification time stamps are not the same as the original files. If that doesn't bug you, then a custom copier is the way to go.

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Mon Mar 31, 2008 12:50 pm

Silly idea here...

Use the revZip commands to write out your files? I have never worked with revZip, but the documentation makes me feel that should be doable.

all the best,

Malte

Post Reply