changeset 848:e3fd75845c5d

Make shared paths work on windows
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 01 Jul 2014 10:10:57 +0200
parents fbd8e6725fe5
children 03275807f45b
files mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SharingMercurialUpdater.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SharingMercurialUpdater.java	Mon Jun 30 22:27:43 2014 +0200
+++ b/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SharingMercurialUpdater.java	Tue Jul 01 10:10:57 2014 +0200
@@ -25,6 +25,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.regex.Pattern;
 
 public class SharingMercurialUpdater extends MercurialIncludeRuleUpdater {
   public SharingMercurialUpdater(@NotNull AgentPluginConfig pluginConfig,
@@ -81,7 +82,13 @@
   }
 
   private void writeSharedPath(@NotNull File mirrorHg, @NotNull File workingDir) throws IOException {
-    FileUtil.writeToFile(getSharedPath(workingDir), (mirrorHg.getCanonicalPath() + "\n").getBytes("UTF-8"));
+    FileUtil.writeToFile(getSharedPath(workingDir), getCanonicalSharedPath(mirrorHg).getBytes("UTF-8"));
+  }
+
+  @NotNull
+  private String getCanonicalSharedPath(@NotNull File mirrorHg) throws IOException {
+    String path = mirrorHg.getCanonicalPath();
+    return path.replaceAll(Pattern.quote("\\"), "/") + "\n";
   }
 
   private void writeRequires(@NotNull File mirrorHg, @NotNull File workingDir) throws IOException {