[Logo] smithproject.org
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
CFFILE MOVE fails if source and destination are not in same filesystem (patch inside)  XML
Forum Index -> Smith Development
Author Message
Cars2007



Joined: 25/01/2008 23:52:18
Messages: 20
Offline

Hello,

I scratched my head over this one for a long time. Java's File.moveTo(), which Smith uses to move files, fails when the source and destination files are in directories in different filesystems.

In FileTagImpl.java, in the private void move() method, I modified the last code block as follows:
Code:
		if (!source.equalsIgnoreCase(destination) && !s.renameTo(new_file)) {
 			new_file.delete();
 			if (!s.renameTo(new_file)) {
 				// file.renameTo() does not work across different filesystems,
 				// so we have to copy the file and then delete the source instead.
 				try {
 					this.copyFile(source, destination);
 					s.delete();
 				} catch (Exception ex) {
 					throw new ApplicationException(new ErrMsg(
 							"error.misc.invalid_variable", source, "FILE"));
 				}
 			}
 		}
 
orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

Hi Cars,
thanks for the patch! We will test and apply this.

Note that we have a bug/patch/feature_request tracker at SourceForge.net
(http://sourceforge.net/projects/smithos/, just click on Tracker in the menu). That's the best place to post these little things.

Thanks for testing and helping Smith become a better product!
Best regards,
orcus


orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

Patch tested and applied... available in SVN, will be included in the next build.

Thanks Cars!
 
Forum Index -> Smith Development
Go to:   
Powered by JForum 2.1.6 © JForum Team