mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
[181553] delete obsolete temp files before transfering
This commit is contained in:
parent
b5980ec2a6
commit
216e97eaf8
4 changed files with 47 additions and 6 deletions
|
@ -40,6 +40,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
@ -436,9 +437,44 @@ public class UniversalFileTransferUtility
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return resultSet;
|
return resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void discardReplicasOfDeletedFiles(IRemoteFileSubSystem ss, IContainer folder)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IResource[] members = folder.members();
|
||||||
|
for (int i = 0; i < members.length; i++)
|
||||||
|
{
|
||||||
|
IResource member = members[i];
|
||||||
|
if (member instanceof IFile)
|
||||||
|
{
|
||||||
|
// is this a valid replica?
|
||||||
|
SystemIFileProperties properties = new SystemIFileProperties(member);
|
||||||
|
String path = properties.getRemoteFilePath();
|
||||||
|
if (path != null)
|
||||||
|
{
|
||||||
|
IRemoteFile remoteFile = ss.getRemoteFileObject(path);
|
||||||
|
if (remoteFile != null && !remoteFile.exists())
|
||||||
|
{
|
||||||
|
// this must be old so we should delete this
|
||||||
|
member.delete(false, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (member instanceof IContainer)
|
||||||
|
{
|
||||||
|
discardReplicasOfDeletedFiles(ss, (IContainer)member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Object copyRemoteResourceToWorkspace(File srcFileOrFolder, IProgressMonitor monitor) {
|
public static Object copyRemoteResourceToWorkspace(File srcFileOrFolder, IProgressMonitor monitor) {
|
||||||
|
|
||||||
if (!srcFileOrFolder.exists()) {
|
if (!srcFileOrFolder.exists()) {
|
||||||
|
|
|
@ -1500,7 +1500,12 @@ public class SystemViewRemoteFileAdapter
|
||||||
for (int i = 0; i < set.size(); i++)
|
for (int i = 0; i < set.size(); i++)
|
||||||
{
|
{
|
||||||
IRemoteFile remoteFile = (IRemoteFile)set.get(i);
|
IRemoteFile remoteFile = (IRemoteFile)set.get(i);
|
||||||
hierarchicalResult.addResource(UniversalFileTransferUtility.getTempFileFor(remoteFile));
|
IResource tempResource = UniversalFileTransferUtility.getTempFileFor(remoteFile);
|
||||||
|
if (tempResource instanceof IContainer)
|
||||||
|
{
|
||||||
|
UniversalFileTransferUtility.discardReplicasOfDeletedFiles((IRemoteFileSubSystem)set.getSubSystem(), (IContainer)tempResource);
|
||||||
|
}
|
||||||
|
hierarchicalResult.addResource(tempResource);
|
||||||
}
|
}
|
||||||
return hierarchicalResult;
|
return hierarchicalResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class DStoreHostFile implements IHostFile
|
||||||
String str = getAttribute(_element.getSource(), ATTRIBUTE_CAN_READ);
|
String str = getAttribute(_element.getSource(), ATTRIBUTE_CAN_READ);
|
||||||
if (str == null)
|
if (str == null)
|
||||||
{
|
{
|
||||||
System.out.println("HELP:"+_element.toString()); //$NON-NLS-1$
|
//System.out.println("HELP:"+_element.toString()); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -76,12 +76,12 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
|
||||||
String parentPath = pathOnly;
|
String parentPath = pathOnly;
|
||||||
if (nameSep > 0)
|
if (nameSep > 0)
|
||||||
{
|
{
|
||||||
parentName = pathOnly.substring(nameSep);
|
parentName = pathOnly.substring(nameSep + 1);
|
||||||
parentPath = pathOnly.substring(0, nameSep);
|
parentPath = pathOnly.substring(0, nameSep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentName = pathOnly.substring(nameSep);
|
parentName = pathOnly.substring(nameSep + 1);
|
||||||
parentPath = "" + sep;
|
parentPath = "" + sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue