diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java index 06968dfff..61e16563e 100644 --- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java +++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Tasktop Technologies and others. + * Copyright (c) 2009, 2013 Tasktop Technologies and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -147,4 +147,14 @@ public class TransportUtil { return countFound == locations.size(); } + public static String getFileNameFor(String bundleUrl) { + if (bundleUrl.charAt(bundleUrl.length() - 1) == '/') { + bundleUrl = bundleUrl.substring(0, bundleUrl.length() - 1); + } + if (bundleUrl.lastIndexOf('/') != -1) { + bundleUrl = bundleUrl.substring(bundleUrl.lastIndexOf('/') + 1); + } + return bundleUrl.replaceAll("[^a-zA-Z0-9_\\.]", "_"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } |