提交 14087498 编写于 作者: K kohsuke

improved the path handling logic. (#1248)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6980 71c3de6d-444a-0410-be80-ed276b4c234a
上级 02954921
......@@ -169,8 +169,12 @@ public final class FilePath implements Serializable {
* Checks if the remote path is Unix.
*/
private boolean isUnix() {
// Windows absolute path always include ':', but this is not a valid char in Unix file systems.
if(remote.contains(":")) return false;
// note that we can't use the usual File.pathSeparator and etc., as the OS of
// the machine where this code runs and the OS that this FilePath refers to may be different.
// Windows absolute path is 'X:\...', so this is usually a good indication of Windows path
if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\')
return false;
// Windows can handle '/' as a path separator but Unix can't,
// so err on Unix side
return remote.indexOf("\\")==-1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册