You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2016/10/27 00:54:18 UTC
jclouds git commit: filesystem: Modify the backslash only on Windows
Repository: jclouds
Updated Branches:
refs/heads/master af09f3a5a -> 78b3120e5
filesystem: Modify the backslash only on Windows
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/78b3120e
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/78b3120e
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/78b3120e
Branch: refs/heads/master
Commit: 78b3120e5e680cf5cde6e3201e36409606e0bab6
Parents: af09f3a
Author: Zack Shoylev <za...@rackspace.com>
Authored: Wed Oct 26 16:35:07 2016 -0500
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Wed Oct 26 19:53:55 2016 -0500
----------------------------------------------------------------------
.../strategy/internal/FilesystemStorageStrategyImpl.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/78b3120e/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
index 0c0a59a..7e65dcd 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
@@ -750,7 +750,10 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
*/
private static String normalize(String path) {
if (null != path) {
- return path.replace("/", File.separator).replace("\\", File.separator);
+ if (isWindows()) {
+ path = path.replace("\\", File.separator);
+ }
+ return path.replace("/", File.separator);
}
return path;
}
@@ -759,7 +762,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
* Convert path to jclouds standard (/)
*/
private static String denormalize(String path) {
- if (null != path) {
+ if (null != path && isWindows() ) {
return path.replace("\\", "/");
}
return path;
@@ -782,11 +785,11 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
// search for separator chars
if (!onlyTrailing) {
- if (pathToBeCleaned.charAt(0) == '/' || pathToBeCleaned.charAt(0) == '\\')
+ if (pathToBeCleaned.charAt(0) == '/' || (pathToBeCleaned.charAt(0) == '\\' && isWindows()))
beginIndex = 1;
}
if (pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '/' ||
- pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '\\')
+ (pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '\\' && isWindows()))
endIndex--;
return pathToBeCleaned.substring(beginIndex, endIndex);