org.eclipse.rse.services.clientserver
Class PathUtility
java.lang.Object
org.eclipse.rse.services.clientserver.PathUtility
-
public class PathUtility
- extends
Object
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
PathUtility
public PathUtility()
normalizeWindows
public static
String normalizeWindows(
String path)
- Normalize a path name that is supposed to be Windows style.
Replaces / characters by \ and remove duplicate \ characters.
-
-
Parameters:
-
path
- a path to normalize
-
Returns:
- a normalized path.
normalizeUnix
public static
String normalizeUnix(
String path)
-
Deprecated. this should not be used since \ is a valid part of
UNIX file names. Also, a better normalizer would also consider
swquences like a/../b and a/./b -- Try to work without this
method.
- Normalize a path name that is supposed to be UNIX style.
Replaces \ characters by / and remove duplicate / characters.
-
-
Parameters:
-
path
- a path to normalize
-
Returns:
- a normalized path.
normalizeVirtualWindows
public static
String normalizeVirtualWindows(
String path)
-
normalizeVirtualUnix
public static
String normalizeVirtualUnix(
String path)
-
normalizeUnknown
public static
String normalizeUnknown(
String path)
-
getSeparator
public static
String getSeparator(
String path)
- Given a path name, try to guess what separator is used.
Should only be used for absolute path names, but tries to compute
a good fallback in case of relative path names as well.
-
-
Parameters:
-
path
- a path to check
-
Returns:
- a separator String for the given path: either "/" or "\\"
enQuoteUnix
public static
String enQuoteUnix(
String s)
- Quotes a string such that it can be used in a remote UNIX shell.
This has been tested with sh, bash and tcsh shells.
On Windows, special characters likes quotes and dollar sign. and
- most importantly - the backslash will not be quoted correctly.
Newline is only quoted correctly in tcsh. But since this is mainly
intended for file names, it should work OK in almost every case.
-
-
Parameters:
-
s
- String to be quoted
-
Returns:
- quoted string, or original if no quoting was necessary.
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.