summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorStephan Leicht Vogt2012-07-27 15:36:47 (EDT)
committer Igor Fedorenko2012-07-30 06:34:36 (EDT)
commite58861033fdadbae0563a703feae75bc50245bee (patch)
tree0a8fb7b75876f963df50795248efc80fd6d72080
parent1023ca62a3247950748af722c0961080c0de5d68 (diff)
downloadorg.eclipse.tycho.extras-e58861033fdadbae0563a703feae75bc50245bee.zip
org.eclipse.tycho.extras-e58861033fdadbae0563a703feae75bc50245bee.tar.gz
org.eclipse.tycho.extras-e58861033fdadbae0563a703feae75bc50245bee.tar.bz2
386133 Remove also windows path delimiter in getRelPath
Bug: 386133 Change-Id: I8ff9e8bd97aa1414d6d379aee10891705e45942b 386133 Remove also windows path delimiter in getRelPath This change from Marco Lehman seems the safer solution. It searches for File.separator and removes this and replaces all separator from the path string with '/'. Thanks Change-Id: I8ff9e8bd97aa1414d6d379aee10891705e45942b
-rw-r--r--tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
index 9649a70..320ce0b 100644
--- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
+++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.tycho.extras.buildtimestamp.jgit;
+import java.io.File;
import java.io.IOException;
import java.util.Date;
@@ -115,10 +116,13 @@ public class JGitBuildTimestampProvider implements BuildTimestampProvider {
path = path.substring(workTree.length());
- if (path.startsWith("/")) {
- path = path.substring(1);
+ if (path.startsWith(File.separator)) {
+ path = path.substring(File.separator.length());
}
+ // git stores paths unix-style
+ path = path.replace(File.separatorChar, '/');
+
return path;
}
}