OSDN Git Service

ADT NPW and GLE: fix AdtPlugin.getEmbeddedFileUrl
authorRaphael <raphael@google.com>
Wed, 31 Mar 2010 23:25:10 +0000 (16:25 -0700)
committerRaphael <raphael@google.com>
Thu, 1 Apr 2010 00:27:38 +0000 (17:27 -0700)
The method was always adding an initial slash to the path.
This is only needed if the requested path doesn't have one.

This fixes the NPW templates and the GLE scripts usage.

SDK Bug: 2546962

Change-Id: If19eb0a5b931eeb1d160c980f950eb0a974246e8

eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java

index d10b981..a9336b2 100644 (file)
@@ -580,16 +580,21 @@ public class AdtPlugin extends AbstractUIPlugin {
             if (sPlugin != null) {
                 bundle = sPlugin.getBundle();
             } else {
+                AdtPlugin.log(IStatus.WARNING, "ADT Plugin is missing");    //$NON-NLS-1$
                 return null;
             }
         }
 
         // attempt to get a file to one of the template.
-        String path = AndroidConstants.WS_SEP + filepath;
+        String path = filepath;
+        if (!path.startsWith(AndroidConstants.WS_SEP)) {
+            path = AndroidConstants.WS_SEP + path;
+        }
+
         URL url = bundle.getEntry(path);
 
         if (url == null) {
-            AdtPlugin.log(IStatus.INFO, "Bundle file URL not found at path '%s'", path);
+            AdtPlugin.log(IStatus.INFO, "Bundle file URL not found at path '%s'", path); //$NON-NLS-1$
         }
 
         return url;