[Esbox-commits] r2209 - branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Tue Sep 22 17:00:29 EEST 2009
Author: eswartz
Date: 2009-09-22 17:00:27 +0300 (Tue, 22 Sep 2009)
New Revision: 2209
Modified:
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
Log:
Fix bug with spaces in path. URL's path has %20, etc. but URI doesn't.
Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java 2009-09-21 12:48:23 UTC (rev 2208)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java 2009-09-22 14:00:27 UTC (rev 2209)
@@ -19,6 +19,7 @@
import java.net.CookieHandler;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.regex.Matcher;
@@ -248,7 +249,13 @@
private File getLocalFile(URL remoteURL, URL installLocation) {
String fileName = (new Path(remoteURL.getFile())).lastSegment();
fileName = fileName.substring(fileName.lastIndexOf("=") + 1);
- return new File ((new Path(installLocation.getFile())).append(fileName).toOSString());
+ String localPath;
+ try {
+ localPath = installLocation.toURI().getPath();
+ } catch (URISyntaxException e) {
+ localPath = installLocation.getFile().replaceAll("%20", " "); // HACK
+ }
+ return new File ((new Path(localPath)).append(fileName).toOSString());
}
/**
More information about the Esbox-commits
mailing list