|
41 | 41 | import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
42 | 42 | import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
|
43 | 43 | import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
|
| 44 | +import org.apache.commons.io.FileUtils; |
44 | 45 | import org.eclipse.core.runtime.IPath;
|
45 | 46 | import org.eclipse.core.runtime.IProgressMonitor;
|
46 | 47 | import org.eclipse.core.runtime.IStatus;
|
@@ -194,6 +195,13 @@ public static File getLocalFileName(String url) {
|
194 | 195 | Common.log(new Status(IStatus.ERROR, Activator.getId(), "Malformed url " + url, e)); //$NON-NLS-1$
|
195 | 196 | return null;
|
196 | 197 | }
|
| 198 | + if("file".equals(packageUrl.getProtocol())) { //$NON-NLS-1$ |
| 199 | + String tst=packageUrl.getFile(); |
| 200 | + File file=new File(tst); |
| 201 | + String localFileName = file.getName(); |
| 202 | + Path packagePath = Paths.get(ConfigurationPreferences.getInstallationPath().append(localFileName).toString()); |
| 203 | + return packagePath.toFile(); |
| 204 | + } |
197 | 205 | String localFileName = Paths.get(packageUrl.getPath()).getFileName().toString();
|
198 | 206 | Path packagePath = Paths.get(ConfigurationPreferences.getInstallationPath().append(localFileName).toString());
|
199 | 207 | return packagePath.toFile();
|
@@ -828,6 +836,10 @@ public static void setReady(boolean b) {
|
828 | 836 | */
|
829 | 837 | @SuppressWarnings("nls")
|
830 | 838 | private static void myCopy(URL url, File localFile, boolean report_error) throws IOException {
|
| 839 | + if("file".equals(url.getProtocol())) { |
| 840 | + FileUtils.copyFile(new File(url.getFile()), localFile); |
| 841 | + return; |
| 842 | + } |
831 | 843 | try {
|
832 | 844 | HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
833 | 845 | conn.setReadTimeout(5000);
|
|
0 commit comments