[Esbox-commits] r2092 - trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware

raul at garage.maemo.org raul at garage.maemo.org
Wed Sep 2 22:07:07 EEST 2009


Author: raul
Date: 2009-09-02 22:07:03 +0300 (Wed, 02 Sep 2009)
New Revision: 2092

Modified:
   trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
Log:
Merge revs 2085:2090 from work_Raul to trunk

Modified: trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	2009-09-02 18:55:27 UTC (rev 2091)
+++ trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	2009-09-02 19:07:03 UTC (rev 2092)
@@ -23,6 +23,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
@@ -329,8 +330,9 @@
 				return errorStatus(connectionStatus.getMessage());
 			}
 			
+			Path filePath = new Path(downloadFile.getLocalURL().getPath()); 
 			int contentLength = connection.getContentLength();			
-			if (!haveEnoughtFreeSpace(contentLength/1024, downloadFile.getLocalURL())) {
+			if (!haveEnoughtFreeSpace(contentLength/1024, filePath.removeLastSegments(1))) {
 				cancelDownload(downloadFile, monitor);
 				return errorStatus("There is not enought space to save Maemo SDK virtual machine in your computer.");
 			}
@@ -428,8 +430,8 @@
 	 * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
 	 * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
 	 */
-	private static boolean haveEnoughtFreeSpace(int fileSize, URL localURL) throws IOException {
-		long freeSpace = FilesystemUtils.freeSpaceOS(new Path(localURL.getPath()),true);
+	private static boolean haveEnoughtFreeSpace(int fileSize, IPath localURL) throws IOException {
+		long freeSpace = FilesystemUtils.freeSpaceOS(localURL,true);
 		return freeSpace > fileSize;
 	}
 	



More information about the Esbox-commits mailing list