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

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

revCopyFile

Post by lohill » Tue Jan 29, 2013 9:58 pm

My application accesses a sqlLite database and I'd like to give the user a chance to make a copy of the database they are connected to and then to reconnect to that cloned database. This is all to be done in the default directory. I have tried 'revCopyFile fileA, fileB' but the result shows Execution Error. There is a resulting new file but it has nothing in it. I have also tried 'put URL fileA into URL fileB' with no luck. As I read the Dictionary comments there is an old one about requiring an absolute path that just brought up a second question. How is that determined?

Any help on either revCopyFile or absolute path will be appreciated.
Thanks,
Larry

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revCopyFile

Post by Simon » Tue Jan 29, 2013 10:53 pm

Hi Larry,
You probably already know this but:

Code: Select all

put the effective filename of this stack into tPath
    set the itemDelimiter to slash
    delete last item of tPath
put fileA into url("binfile:" & tPAth & "/fileB")
Will put the file in the same folder as the stack. You can use any of the specialFoderPath as well.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: revCopyFile

Post by lohill » Wed Jan 30, 2013 12:28 am

Thanks Simon,

That took care of the path part but the file that was created was empty rather than a clone. I guess I'll just have to tell my user to go to the Finder, copy and paste with the desired name.

Larry

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revCopyFile

Post by Simon » Wed Jan 30, 2013 12:44 am

Hi Larry,
I've copied files lots of times without trouble.
Maybe I didn't use enough words:

Code: Select all

put the effective filename of this stack into tPath
    set the itemDelimiter to slash
    delete last item of tPath
put url "http://www.mysite.com/database.sql"into url("binfile:" & tPAth & "/database.sql")
Does that help?
For larger files:

Code: Select all

put the effective filename of this stack into tPath
    set the itemDelimiter to slash
    delete last item of tPath
libURLDownloadToFile "http://www.mysite.com/database.sql", tPAth & "/database.sql"

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply