1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-30 19:53:30 +02:00

[192741] Fix extract (copy, move) from archive if more than 1 level deep

This commit is contained in:
Martin Oberhuber 2007-07-05 08:11:40 +00:00
parent dce2ff6b5d
commit fd3a307707
2 changed files with 13 additions and 2 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.services;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Version: 2.0.1.qualifier
Bundle-Activator: org.eclipse.rse.internal.services.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -13,6 +13,7 @@
*
* Contributors:
* {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep
*******************************************************************************/
package org.eclipse.rse.services.clientserver.archiveutils;
@ -712,7 +713,17 @@ public class SystemZipHandler implements ISystemArchiveHandler
File topFile = destination;
String topFilePath = topFile.getAbsolutePath().replace('\\', '/');
//if (!dir.equals(topFile.getName()))
if (!topFilePath.endsWith(dir))
String lastPortionOfDir = null;
int lastSlashIndex = dir.lastIndexOf('/');
if (-1 == lastSlashIndex)
{
lastPortionOfDir = dir;
}
else
{
lastPortionOfDir = dir.substring(lastSlashIndex + 1);
}
if (!topFilePath.endsWith(lastPortionOfDir))
{
rename(dir, topFile.getName());
dir = topFile.getName();