SDK Manager: fix, create temp folder before download

SDK BUG 2258237

Change-Id: I361fb688558539e20af50cd0a1d805ddf4ea4828
This commit is contained in:
Raphael
2009-11-12 17:15:54 -08:00
parent 8ccddf4c00
commit 3298a0438e

View File

@@ -452,7 +452,17 @@ public class Archive implements IDescription {
// temp folder (in the SDK base folder) and use the archive name for the // temp folder (in the SDK base folder) and use the archive name for the
// download. This allows us to reuse or continue downloads. // download. This allows us to reuse or continue downloads.
File tmpFile = new File(getTempFolder(osSdkRoot), base); File tmpFolder = getTempFolder(osSdkRoot);
if (!tmpFolder.isDirectory()) {
if (tmpFolder.isFile()) {
deleteFileOrFolder(tmpFolder);
}
if (!tmpFolder.mkdirs()) {
monitor.setResult("Failed to create directory %1$s", tmpFolder.getPath());
return null;
}
}
File tmpFile = new File(tmpFolder, base);
// if the file exists, check if its checksum & size. Use it if complete // if the file exists, check if its checksum & size. Use it if complete
if (tmpFile.exists()) { if (tmpFile.exists()) {
@@ -960,6 +970,9 @@ public class Archive implements IDescription {
File baseTempFolder = getTempFolder(osBasePath); File baseTempFolder = getTempFolder(osBasePath);
if (!baseTempFolder.isDirectory()) { if (!baseTempFolder.isDirectory()) {
if (baseTempFolder.isFile()) {
deleteFileOrFolder(baseTempFolder);
}
if (!baseTempFolder.mkdirs()) { if (!baseTempFolder.mkdirs()) {
return null; return null;
} }