From: Raphael Date: Wed, 31 Mar 2010 23:25:10 +0000 (-0700) Subject: ADT NPW and GLE: fix AdtPlugin.getEmbeddedFileUrl X-Git-Tag: android-x86-2.2~15 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=033a85dd05a72c2017c00eedf94c97169de58c06;p=android-x86%2Fsdk.git ADT NPW and GLE: fix AdtPlugin.getEmbeddedFileUrl 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 --- diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index d10b9819c..a9336b216 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -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;