Lines 13-18
Link Here
|
13 |
* |
13 |
* |
14 |
* Contributors: |
14 |
* Contributors: |
15 |
* {Name} (company) - description of contribution. |
15 |
* {Name} (company) - description of contribution. |
|
|
16 |
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors |
16 |
*******************************************************************************/ |
17 |
*******************************************************************************/ |
17 |
|
18 |
|
18 |
package org.eclipse.rse.services.clientserver.archiveutils; |
19 |
package org.eclipse.rse.services.clientserver.archiveutils; |
Lines 367-374
Link Here
|
367 |
String newPath = fullVirtualName; |
368 |
String newPath = fullVirtualName; |
368 |
if (j != -1) |
369 |
if (j != -1) |
369 |
{ |
370 |
{ |
370 |
realPart = fullVirtualName.substring(0, j) + VIRTUAL_SEPARATOR; |
371 |
try |
371 |
newPath = fullVirtualName.substring(j + VIRTUAL_SEPARATOR.length()); |
372 |
{ |
|
|
373 |
realPart = fullVirtualName.substring(0, j) + VIRTUAL_SEPARATOR; |
374 |
if (j + VIRTUAL_SEPARATOR.length() < fullVirtualName.length()) |
375 |
{ |
376 |
newPath = fullVirtualName.substring(j + VIRTUAL_SEPARATOR.length()); |
377 |
} |
378 |
else |
379 |
{ |
380 |
//This is the special case where fullVirtualName ends with VIRTUAL_SEPARATOR |
381 |
newPath = ""; //$NON-NLS-1$ |
382 |
} |
383 |
} |
384 |
catch (Exception e) |
385 |
{ |
386 |
e.printStackTrace(); |
387 |
} |
372 |
} |
388 |
} |
373 |
// use only forward slash separator |
389 |
// use only forward slash separator |
374 |
newPath = newPath.replace('\\', '/'); |
390 |
newPath = newPath.replace('\\', '/'); |
Lines 386-391
Link Here
|
386 |
if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$ |
402 |
if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$ |
387 |
return realPart + newPath; |
403 |
return realPart + newPath; |
388 |
} |
404 |
} |
|
|
405 |
|
406 |
/** |
407 |
* Construct the full virtual name of a virtual file from its virtual path and name. |
408 |
* @param virtualPath the virtual path of this virtual file |
409 |
* @param name the name of this virtual file |
410 |
* @return the full virtual name of this virtual file |
411 |
*/ |
412 |
public static String getFullVirtualName(String virtualPath, String name) |
413 |
{ |
414 |
String fullVirtualName = null; |
415 |
if (virtualPath == null || virtualPath.length() == 0) |
416 |
{ |
417 |
fullVirtualName = name; |
418 |
} |
419 |
else |
420 |
{ |
421 |
fullVirtualName = virtualPath + "/" + name; //$NON-NLS-1$ |
422 |
} |
423 |
return fullVirtualName; |
424 |
} |
389 |
|
425 |
|
390 |
/** |
426 |
/** |
391 |
* Disposes of all registered handlers. |
427 |
* Disposes of all registered handlers. |