SOLR-7158: Fix zk upload on Windows systems

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1662205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alan Woodward 2015-02-25 12:29:56 +00:00
parent 822068e56b
commit 8e0ce8dd0b
2 changed files with 12 additions and 3 deletions

View File

@ -112,8 +112,8 @@ New Features
* SOLR-1945: Add support for child docs in DocumentObjectBinder (Noble Paul, Mark Miller)
* SOLR-7125: You can upload and download configurations via CloudSolrClient
(Alan Woodward)
* SOLR-7125, SOLR-7158: You can upload and download configurations via CloudSolrClient
(Alan Woodward, Ishan Chattopadhyaya)
* SOLR-5507: Admin UI - Refactoring using AngularJS, first part (Upayavira via
Erick Erickson)

View File

@ -61,7 +61,7 @@ public class ZkConfigManager {
String filename = file.getFileName().toString();
if (filename.startsWith("."))
return FileVisitResult.CONTINUE;
String zkNode = zkPath + "/" + rootPath.relativize(file).toString();
String zkNode = createZkNodeName(zkPath, rootPath, file);
try {
zkClient.makePath(zkNode, file.toFile(), false, true);
} catch (KeeperException | InterruptedException e) {
@ -78,6 +78,15 @@ public class ZkConfigManager {
});
}
private static String createZkNodeName(String zkRoot, Path root, Path file) {
String relativePath = root.relativize(file).toString();
// Windows shenanigans
String separator = root.getFileSystem().getSeparator();
if ("\\".equals(separator))
relativePath = relativePath.replaceAll("\\\\", "/");
return zkRoot + "/" + relativePath;
}
private void downloadFromZK(String zkPath, Path dir) throws IOException {
try {
List<String> files = zkClient.getChildren(zkPath, null, true);