diff src/org/tmatesoft/hg/internal/Internals.java @ 292:a415fe296a50

Refactor PathRewrite to accept any char sequence, not only string
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 14 Sep 2011 02:16:19 +0200
parents 706bcc7cfee4
children 981f9f50bb6c
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java	Wed Sep 14 02:12:47 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/Internals.java	Wed Sep 14 02:16:19 2011 +0200
@@ -54,17 +54,12 @@
 	public PathRewrite buildRepositoryFilesHelper() {
 		if ((requiresFlags & STORE) != 0) {
 			return new PathRewrite() {
-				public String rewrite(String path) {
+				public CharSequence rewrite(CharSequence path) {
 					return "store/" + path;
 				}
 			};
 		} else {
-			return new PathRewrite() {
-				public String rewrite(String path) {
-					//no-op
-					return path;
-				}
-			};
+			return new PathRewrite.Empty();
 		}
 	}
 
@@ -108,4 +103,8 @@
 		new File(hgDir, "store").mkdir(); // with that, hg verify says ok.
 	}
 
+	public static boolean runningOnWindows() {
+		return System.getProperty("os.name").indexOf("Windows") != -1;
+	}
+
 }