Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Internals.java @ 409:0f5696623512 smartgit3
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Mar 2012 20:14:47 +0100 |
parents | 30922c728341 |
children | 464b4404e75d |
comparison
equal
deleted
inserted
replaced
408:e732521a9eb4 | 409:0f5696623512 |
---|---|
81 requiresFlags = flags; | 81 requiresFlags = flags; |
82 } | 82 } |
83 | 83 |
84 public PathRewrite buildNormalizePathRewrite() { | 84 public PathRewrite buildNormalizePathRewrite() { |
85 if (runningOnWindows()) { | 85 if (runningOnWindows()) { |
86 return new PathRewrite() { | 86 return new WinToNixPathRewrite(); |
87 | |
88 public CharSequence rewrite(CharSequence p) { | |
89 // TODO handle . and .. (although unlikely to face them from GUI client) | |
90 String path = p.toString(); | |
91 path = path.replace('\\', '/').replace("//", "/"); | |
92 if (path.startsWith("/")) { | |
93 path = path.substring(1); | |
94 } | |
95 return path; | |
96 } | |
97 }; | |
98 } else { | 87 } else { |
99 return new PathRewrite.Empty(); // or strip leading slash, perhaps? | 88 return new PathRewrite.Empty(); // or strip leading slash, perhaps? |
100 } | 89 } |
101 } | 90 } |
102 | 91 |