1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[337612] Failed to copy the content of a tar file

This commit is contained in:
David McKnight 2011-03-01 16:04:29 +00:00
parent bac970f24b
commit 59a93f1376

View file

@ -69,14 +69,19 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.internal.services.local.Activator;
@ -1402,13 +1407,20 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
}
private boolean isTempFile(File resource){
Location instanceLoc = Platform.getInstanceLocation();
URL workspaceLocation = instanceLoc.getURL(); // currently, Eclipse doesn't escape URLs
String wsLocation = new File(workspaceLocation.getPath()).toURI().toString();
String fileLocation = resource.toURI().toString();
return fileLocation.startsWith(wsLocation);
try {
URI wsURI = URIUtil.toURI(Platform.getInstanceLocation().getURL());
File wsRoot = URIUtil.toFile(wsURI);
if (wsRoot!=null) {
File rsProj = new File(wsRoot, "RemoteSystemsTempFiles"); //$NON-NLS-1$
IPath rsProjPath = new Path(rsProj.getAbsolutePath());
IPath resPath = new Path(resource.getAbsolutePath());
return rsProjPath.isPrefixOf(resPath);
//could also compare canonical paths at this point but won't do here
//since it is costly and most likely not needed for the Tempfiles project.
}
} catch (URISyntaxException e) {
}
return false;
}
/**