mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-5911 fix FS & drive letter root dir lookup problem.
Looking up "c:/" would treat it as the global "/" root dir.
This commit is contained in:
parent
e01d4b3710
commit
285fe59bcb
1 changed files with 4 additions and 1 deletions
|
@ -124,7 +124,7 @@ public class LocalFileSystem implements GFileSystem, GFileHashProvider {
|
||||||
public GFile getGFile(File f) {
|
public GFile getGFile(File f) {
|
||||||
List<File> parts = LocalFileSystem.getFilePathParts(f); // [/subdir/subroot/file, /subdir/subroot, /subdir, /]
|
List<File> parts = LocalFileSystem.getFilePathParts(f); // [/subdir/subroot/file, /subdir/subroot, /subdir, /]
|
||||||
GFile current = rootDir;
|
GFile current = rootDir;
|
||||||
for (int i = parts.size() - 2; i >= 0; i--) {
|
for (int i = parts.size() - (isWindows ? 1 : 2); i >= 0; i--) {
|
||||||
File part = parts.get(i);
|
File part = parts.get(i);
|
||||||
FSRL childFSRL = getLocalFSRL(part);
|
FSRL childFSRL = getLocalFSRL(part);
|
||||||
current =
|
current =
|
||||||
|
@ -221,6 +221,9 @@ public class LocalFileSystem implements GFileSystem, GFileHashProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GFile lookup(String path, Comparator<String> nameComp) throws IOException {
|
public GFile lookup(String path, Comparator<String> nameComp) throws IOException {
|
||||||
|
if (path == null || path.equals(rootDir.getPath() /* should be "/" */)) {
|
||||||
|
return rootDir;
|
||||||
|
}
|
||||||
File f = lookupFile(null, path, nameComp);
|
File f = lookupFile(null, path, nameComp);
|
||||||
return f != null ? getGFile(f) : null;
|
return f != null ? getGFile(f) : null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue