Skip to content

Commit

Permalink
0001430: When a file is modified on Windows it is not unpacked at the…
Browse files Browse the repository at this point in the history
… target of a file sync
  • Loading branch information
chenson42 committed Oct 1, 2013
1 parent 431360c commit 83bb1e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Expand Up @@ -199,22 +199,29 @@ public void end(Batch batch, boolean inError) {
command.append(" if (!targetBaseDirFile.exists()) {\n");
command.append(" targetBaseDirFile.mkdirs();\n");
command.append(" }\n");
command.append(" org.apache.commons.io.FileUtils.copyFile(new java.io.File(batchDir + \"/\"");
command.append(" java.io.File sourceFile = new java.io.File(batchDir + \"/\"");
if (!snapshot.getRelativeDir().equals(".")) {
command.append(" + sourceFilePath + \"/\"");
}
command.append(" + sourceFileName");
command.append("), new java.io.File(");
command.append(");\n");

command.append(" java.io.File targetFile = new java.io.File(");
StringBuilder targetFile = new StringBuilder(
"targetBaseDir + \"/");
if (!snapshot.getRelativeDir().equals(".")) {
targetFile.append(StringEscapeUtils.escapeJava(snapshot
.getRelativeDir()));
targetFile.append("/");
targetFile.append("/");
}
targetFile.append("\" + targetFileName");
command.append(targetFile);
command.append("), true);\n");
command.append(");\n");
command.append(" if (sourceFile.isDirectory()) {\n");
command.append(" org.apache.commons.io.FileUtils.copyDirectory(sourceFile, targetFile, true);\n");
command.append(" } else {\n");
command.append(" org.apache.commons.io.FileUtils.copyFile(sourceFile, targetFile, true);\n");
command.append(" }\n");
command.append(" fileList.put(").append(targetFile)
.append(",\"");
command.append(eventType.getCode());
Expand Down
Expand Up @@ -93,13 +93,14 @@ protected void testInitialLoadFromServerToClient(ISymmetricEngine rootServer,

protected void testPullAllFromServerToClient(ISymmetricEngine rootServer,
ISymmetricEngine clientServer) throws Exception {
File allFile1 = new File(allSvrSourceDir, "1.txt");
File allFile1 = new File(allSvrSourceDir, "subdir/1.txt");
allFile1.getParentFile().mkdirs();
String file1Contents = "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz";
FileUtils.write(allFile1, file1Contents);

pullFiles();

File allFile1Target = new File(allClntTargetDir, allFile1.getName());
File allFile1Target = new File(allClntTargetDir, allFile1.getParentFile().getName() + "/" + allFile1.getName());
assertTrue(allFile1Target.exists());
assertEquals(file1Contents, FileUtils.readFileToString(allFile1Target));

Expand Down

0 comments on commit 83bb1e7

Please sign in to comment.