aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src/com/android/ant/TaskHelper.java
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2010-08-10 10:20:46 -0700
committerRaphael Moll <ralf@android.com>2010-08-10 10:20:46 -0700
commit1cfea05df04b8cff0fc4d2d9ee62e58009e4e35f (patch)
tree077b2f479519d2376754be71f1f596fea5ab45b8 /anttasks/src/com/android/ant/TaskHelper.java
parent271fe07ba885bd17784c0a28e4a5b6b7c3034015 (diff)
downloadsdk-1cfea05df04b8cff0fc4d2d9ee62e58009e4e35f.zip
sdk-1cfea05df04b8cff0fc4d2d9ee62e58009e4e35f.tar.gz
sdk-1cfea05df04b8cff0fc4d2d9ee62e58009e4e35f.tar.bz2
Ant: ensure SDK path ends with dir separator.
SDK Bug: 2906094 Change-Id: Ic4053c97c8dd5a32a2276e22644b5e09c91d52f0
Diffstat (limited to 'anttasks/src/com/android/ant/TaskHelper.java')
-rw-r--r--anttasks/src/com/android/ant/TaskHelper.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/anttasks/src/com/android/ant/TaskHelper.java b/anttasks/src/com/android/ant/TaskHelper.java
index 22cfb30..e29175b 100644
--- a/anttasks/src/com/android/ant/TaskHelper.java
+++ b/anttasks/src/com/android/ant/TaskHelper.java
@@ -35,22 +35,27 @@ final class TaskHelper {
static File getSdkLocation(Project antProject) {
// get the SDK location
- String sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK);
+ String sdkOsPath = antProject.getProperty(ProjectProperties.PROPERTY_SDK);
// check if it's valid and exists
- if (sdkLocation == null || sdkLocation.length() == 0) {
+ if (sdkOsPath == null || sdkOsPath.length() == 0) {
// LEGACY support: project created with 1.6 or before may be using a different
// property to declare the location of the SDK. At this point, we cannot
// yet check which target is running so we check both always.
- sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK_LEGACY);
- if (sdkLocation == null || sdkLocation.length() == 0) {
+ sdkOsPath = antProject.getProperty(ProjectProperties.PROPERTY_SDK_LEGACY);
+ if (sdkOsPath == null || sdkOsPath.length() == 0) {
throw new BuildException("SDK Location is not set.");
}
}
- File sdk = new File(sdkLocation);
+ // Make sure the OS sdk path ends with a directory separator
+ if (sdkOsPath.length() > 0 && !sdkOsPath.endsWith(File.separator)) {
+ sdkOsPath += File.separator;
+ }
+
+ File sdk = new File(sdkOsPath);
if (sdk.isDirectory() == false) {
- throw new BuildException(String.format("SDK Location '%s' is not valid.", sdkLocation));
+ throw new BuildException(String.format("SDK Location '%s' is not valid.", sdkOsPath));
}
return sdk;