Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Nov 14, 2018 6:31 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 3:59 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Hi,
I have the following code:

dim SourceFolder as FolderItem
dim DestFolder as FolderItem
dim d as new date

SourceFolder = app.ExecutableFile.Parent
DestFolder = SpecialFolder.DeskTop.Child(SourceFolder.Name + " Backup " + "(" + str(d.day) + "." + str(d.month) + "." + str(d.year) +")")

FileCount = 0
FileTotal = CountFiles(SourceFolder)
CopyFileOrFolder(SourceFolder, DestFolder)

self.Close


If my app is run from the user's hard drive - the back-up works perfect and everything is copied to the desktop.
BUT
If my app is run from a USB stick - the back-up to desktop fails (it freezes).

I am presuming the problem is because there is no desktop directory on the USB stick.
Is it possible to change the "DestFolder" path in the code above, in order for my app to be copied from the USB stick, to the desktop of the user's machine.

Thank you all in advance.

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 4:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
SpecialFolder.Desktop will resolve the the same place regardless of where the app is. I don't see any reason why the code should fail. You need to dig a little deeper. Step through the code in the debugger or write out some debug information to system.debuglog or a file.


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 5:34 pm 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
Maybe CopyFileTo is failing because the destination already contains the file you are trying to copy there?

Just a guess.

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 5:41 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
No - it appends the date to the end of the file name so each saved back-up to the desktop is different.

I can't understand why it works perfect EXCEPT when on a USB stick?

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 5:49 pm 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
It appends the date, but not the time, so if you test/use your application more than once a day it will fail.

Anyway, it was just a guess.

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 5:53 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
What is the value of SourceFolder.Name when you run from the USB stick? If the exe is at the root of the stick, that might be the problem.


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 6:37 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Tim,
I'm not quite sure what you are asking me?

The USB stick contains the "app.exe" file, the "App Libs" folder, and the "support files" folder.
All 3 items are simply on the root of the USB stick (not in a folder).

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Fri Aug 17, 2012 9:26 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
If the .exe is at the root, then app.ExecutableFile.Parent.Name is probably something like "e:", which would produce an invalid filename. I think that is your problem. To test that theory, create a folder on the usb stick and put the app in the folder. Then run it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Back-up from USB stick to desktop?
PostPosted: Sat Aug 18, 2012 3:18 am 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
That solved it !

Thank you so much Tim - I really appreciate your help :)

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group