diff options
| author | Raphael <raphael@google.com> | 2009-11-12 17:15:54 -0800 |
|---|---|---|
| committer | Raphael <raphael@google.com> | 2009-11-12 17:15:54 -0800 |
| commit | 3298a0438e2242e6ecfefcb412c39a542e04530c (patch) | |
| tree | ce408ed7c47db0ef44a7bce53fc640584bbf901b /tools | |
| parent | 8ccddf4c00464c6fee998d56da1f08b4662abf62 (diff) | |
| download | android_development-3298a0438e2242e6ecfefcb412c39a542e04530c.tar.gz android_development-3298a0438e2242e6ecfefcb412c39a542e04530c.tar.bz2 android_development-3298a0438e2242e6ecfefcb412c39a542e04530c.zip | |
SDK Manager: fix, create temp folder before download
SDK BUG 2258237
Change-Id: I361fb688558539e20af50cd0a1d805ddf4ea4828
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java index e314bbe0e..040668cc7 100755 --- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java +++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java @@ -452,7 +452,17 @@ public class Archive implements IDescription { // temp folder (in the SDK base folder) and use the archive name for the
// 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 (tmpFile.exists()) {
@@ -960,6 +970,9 @@ public class Archive implements IDescription { File baseTempFolder = getTempFolder(osBasePath);
if (!baseTempFolder.isDirectory()) {
+ if (baseTempFolder.isFile()) {
+ deleteFileOrFolder(baseTempFolder);
+ }
if (!baseTempFolder.mkdirs()) {
return null;
}
|
