Repository: incubator-rya
Updated Branches:
  refs/heads/master 59b20263c -> df6f91380


RYA-447 Closes #264 Fixed issue building rya.shell under Windows.  Loading data 
from relative path test failed due to malformed user.home paths.


Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/df6f9138
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/df6f9138
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/df6f9138

Branch: refs/heads/master
Commit: df6f91380ef8a85603bb8a83b20190b7fdf4015c
Parents: 59b2026
Author: eric.white <eric.wh...@parsons.com>
Authored: Tue Jan 16 13:27:20 2018 -0500
Committer: Valiyil <puja.vali...@parsons.com>
Committed: Fri Feb 2 12:45:48 2018 -0500

----------------------------------------------------------------------
 .../shell/src/main/java/org/apache/rya/shell/RyaCommands.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/df6f9138/extras/shell/src/main/java/org/apache/rya/shell/RyaCommands.java
----------------------------------------------------------------------
diff --git a/extras/shell/src/main/java/org/apache/rya/shell/RyaCommands.java 
b/extras/shell/src/main/java/org/apache/rya/shell/RyaCommands.java
index cfc7436..a650400 100644
--- a/extras/shell/src/main/java/org/apache/rya/shell/RyaCommands.java
+++ b/extras/shell/src/main/java/org/apache/rya/shell/RyaCommands.java
@@ -29,6 +29,7 @@ import java.nio.file.Paths;
 import java.text.DecimalFormat;
 import java.util.Objects;
 
+import org.apache.commons.io.FilenameUtils;
 import org.apache.rya.api.client.RyaClient;
 import org.apache.rya.api.client.RyaClientException;
 import org.apache.rya.shell.SharedShellState.ShellState;
@@ -104,7 +105,11 @@ public class RyaCommands implements CommandMarker {
             final long start = System.currentTimeMillis();
 
             // If the provided path is relative, then make it rooted in the 
user's home.
-            Path rootedFile = Paths.get( file.replaceFirst("^~", 
System.getProperty("user.home")) );
+            // Make sure the path is formatted with Unix style file
+            // separators('/') before using it as a regex replacement string.
+            // Windows file separators('\') will not work unless escaped.
+            final String userHome = 
FilenameUtils.separatorsToUnix(System.getProperty("user.home"));
+            final Path rootedFile = Paths.get( file.replaceFirst("^~", 
userHome) );
 
             RDFFormat rdfFormat = null;
             // If a format was provided, then go with that.

Reply via email to