Skip to content

Commit

Permalink
FORGE-554 Provide options for autocomplete relative to the typed paths.
Browse files Browse the repository at this point in the history
The fix was to ensure that PathspecParser computed the options relative
to the supplied path instead of the drive root.

Also fixed a bug involving display and usage of forward slashes instead
of the OS file separators when displaying the paths or accepting them as
user input in Windows.
  • Loading branch information
VineetReynolds committed Jul 14, 2013
1 parent 27a7a77 commit 4d643cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ else if (path.startsWith("~"))
// for windows, support drive letter prefixes here.
else if (isWindows && path.matches("^[a-zA-Z]{1,1}:(/|\\\\).*"))
{
int idx = path.indexOf(slashChar) + 1;
int idx = path.lastIndexOf(slashChar) + 1;
r = new DirectoryResource(factory, new File(path.substring(0, idx)).getAbsoluteFile());
cursor = idx;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ else if (valueMap.get(option) == null)
for (Resource<?> r : new PathspecParser(resourceFactory, shell.getCurrentResource(), val + "*")
.resolve())
{
// Add result to the results list, and append a '/' if the
// Add result to the results list, and append a file separator ('/' or '\\') if the
// resource has children.
String name = ("~".equals(val) ? "~/" : "") + r.getName()
+ (r.isFlagSet(ResourceFlag.Node) ? "/" : "");
String name = ("~".equals(val) ? "~" + File.separator : "") + r.getName()
+ (r.isFlagSet(ResourceFlag.Node) ? File.separator : "");
results.add(name);
}

Expand Down

0 comments on commit 4d643cf

Please sign in to comment.