43 lines
1.7 KiB
Groff

$OpenBSD: patch-toolong.1,v 1.1 2005/02/06 10:16:17 espie Exp $
--- plugins/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java.orig Tue Jan 4 12:37:17 2005
+++ plugins/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java Tue Jan 4 14:57:54 2005
@@ -128,18 +128,28 @@ public class EclipseBundleData extends D
}
private String searchVariants(String[] variants, String path) {
+ class LibraryFileFilter implements FilenameFilter {
+ String lib_name;
+ LibraryFileFilter(String lib_name) { this.lib_name = lib_name; }
+ public boolean accept(File dir, String name) {
+ if (name.startsWith(lib_name)) {
+ return name.substring(lib_name.length()).matches("\056[0-9]+\056[0-9]+$");
+ }
+ return false;
+ }
+ }
+
for (int i = 0; i < variants.length; i++) {
- BundleEntry libEntry = baseBundleFile.getEntry(variants[i] + path);
- if (libEntry == null) {
- // if (DEBUG && DEBUG_SHOW_FAILURE)
- // debug("not found " + variants[i] + path);
- // //$NON-NLS-1$
- } else {
- // if (DEBUG && DEBUG_SHOW_SUCCESS)
- // debug("found " + path + " as " +
- // variants[i] + path); //$NON-NLS-1$ //$NON-NLS-2$
- File libFile = baseBundleFile.getFile(variants[i] + path);
+ File dir = new File(baseBundleFile.getBaseFile(), variants[i]);
+ // look for unversioned lib first
+ File libFile = new File(dir, path);
+ if (libFile.exists())
return libFile.getAbsolutePath();
+ // then versioned
+ String liblist[] = dir.list(new LibraryFileFilter(path));
+ if (liblist != null && liblist.length > 0) {
+ Arrays.sort(liblist);
+ return new File(dir, liblist[liblist.length - 1]).getAbsolutePath();
}
}
return null;