mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 15:45:25 +02:00
[218491] ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators (with updated fix)
This commit is contained in:
parent
86b4fabf5e
commit
31ba993cba
2 changed files with 32 additions and 4 deletions
|
@ -16,7 +16,7 @@
|
|||
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
|
||||
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
|
||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||
* Xuan Chen (IBM) - [218491] ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators
|
||||
* Xuan Chen (IBM) - [218491] ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators (with updated fix)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -367,7 +367,19 @@ public class ArchiveHandlerManager
|
|||
public static String cleanUpVirtualPath(String fullVirtualName)
|
||||
{
|
||||
int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR);
|
||||
if (j == -1) return fullVirtualName;
|
||||
if (j == -1)
|
||||
{
|
||||
//fullVirtualName does not contains VIRTUAL_CANONICAL_SEPARATOR
|
||||
//fullVirtualName could be the virtual path only, instead of the full path.
|
||||
//So even fullVirtualName does not contains VIRTUAL_CANONICAL_SEPARATOR, we may still
|
||||
//need to process it.
|
||||
//But virtual path should neither start with "\", nor contains
|
||||
//":". So for those two cases, we could just return the fullVirtualName
|
||||
if (fullVirtualName.indexOf(":") != -1 || fullVirtualName.trim().startsWith("\\"))
|
||||
{
|
||||
return fullVirtualName;
|
||||
}
|
||||
}
|
||||
String realPart = ""; //$NON-NLS-1$
|
||||
String newPath = fullVirtualName;
|
||||
if (j != -1)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Xuan Chen (IBM) - [211653] Copy virtual directory with nested directory of tar file did not work
|
||||
* Xuan Chen (IBM) - [214251] [archive] "Last Modified Time" changed for all virtual files/folders if rename/paste/delete of one virtual file.
|
||||
* Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy
|
||||
* Xuan Chen (IBM) - [218491] ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||
|
@ -1355,10 +1356,21 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
if (children[i].isDirectory) {
|
||||
|
||||
// include a '/' at the end, since it is a directory
|
||||
TarEntry nextEntry = tarFile.getEntry(children[i].fullName + "/"); //$NON-NLS-1$
|
||||
TarEntry nextEntry = null;
|
||||
if (!children[i].fullName.endsWith("/")) //$NON-NLS-1$
|
||||
{
|
||||
nextEntry = tarFile.getEntry(children[i].fullName + "/"); //$NON-NLS-1$
|
||||
}
|
||||
else
|
||||
{
|
||||
nextEntry = tarFile.getEntry(children[i].fullName);
|
||||
}
|
||||
|
||||
// put the entry
|
||||
outStream.putNextEntry(nextEntry);
|
||||
if (null != nextEntry)
|
||||
{
|
||||
outStream.putNextEntry(nextEntry);
|
||||
}
|
||||
|
||||
// close the entry
|
||||
outStream.closeEntry();
|
||||
|
@ -2150,6 +2162,10 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
|||
*/
|
||||
public boolean createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) {
|
||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||
if (fullVirtualName.startsWith("folder1"))
|
||||
{
|
||||
System.out.println("fullVirtualName is: " + fullVirtualName);
|
||||
}
|
||||
fullVirtualName = fullVirtualName + "/"; //$NON-NLS-1$
|
||||
boolean returnCode = createVirtualObject(fullVirtualName, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
|
|
Loading…
Add table
Reference in a new issue