1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

[199854] Fix regressions in unit tests

This commit is contained in:
Martin Oberhuber 2008-05-07 08:16:58 +00:00
parent ad14cc2ddf
commit 128bc5d5f8

View file

@ -1207,6 +1207,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
{
File sourceFolderOrFile = new File(srcParent, srcName);
File targetFolder = new File(tgtParent, tgtName);
boolean movedOk = false;
boolean sourceIsVirtual = ArchiveHandlerManager.isVirtual(sourceFolderOrFile.getAbsolutePath());
boolean targetIsVirtual = ArchiveHandlerManager.isVirtual(targetFolder.getAbsolutePath());
boolean targetIsArchive = ArchiveHandlerManager.getInstance().isArchive(targetFolder);
@ -1219,25 +1220,26 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
{
File fileToMove = new File(srcParent, srcName);
File newFile = new File(tgtParent, tgtName);
fileToMove.renameTo(newFile);
return;
//Try plain Java Filesystem move first
movedOk = fileToMove.renameTo(newFile);
}
copy(srcParent, srcName, tgtParent, tgtName, monitor);
try
if (!movedOk)
{
delete(srcParent, srcName, monitor);
}
catch (SystemMessageException exc)
{
if (monitor.isCanceled())
copy(srcParent, srcName, tgtParent, tgtName, monitor);
try {
delete(srcParent, srcName, monitor);
} catch (SystemMessageException exc)
{
//This mean the copy operation is ok, but delete operation has been cancelled by user.
//The delete() call will take care of recovered from the cancel operation.
//So we need to make sure to remove the already copied file/folder.
delete(tgtParent, tgtName, null);
if (monitor.isCanceled())
{
//This mean the copy operation is ok, but delete operation has been cancelled by user.
//The delete() call will take care of recovered from the cancel operation.
//So we need to make sure to remove the already copied file/folder.
delete(tgtParent, tgtName, null);
}
throw exc;
}
throw exc;
}
}