Debugger: Improved file search for dbg file import
This commit is contained in:
parent
2fac266303
commit
ab56dd1ccb
1 changed files with 11 additions and 1 deletions
|
@ -69,11 +69,21 @@ namespace Mesen.GUI.Debugger
|
|||
if(match.Success) {
|
||||
FileInfo file = new FileInfo() {
|
||||
ID = Int32.Parse(match.Groups[1].Value),
|
||||
Name = match.Groups[2].Value.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar)
|
||||
Name = Path.GetFullPath(Path.Combine(basePath, match.Groups[2].Value.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar))).Replace(basePath + Path.DirectorySeparatorChar, "")
|
||||
};
|
||||
|
||||
try {
|
||||
string sourceFile = Path.Combine(basePath, file.Name);
|
||||
while(!File.Exists(sourceFile)) {
|
||||
//Go back up folder structure to attempt to find the file
|
||||
string oldPath = basePath;
|
||||
basePath = Path.GetFullPath(Path.Combine(basePath, @"..\"));
|
||||
if(basePath == oldPath) {
|
||||
break;
|
||||
}
|
||||
sourceFile = Path.Combine(basePath, file.Name);
|
||||
}
|
||||
|
||||
if(File.Exists(sourceFile)) {
|
||||
file.Data = File.ReadAllLines(sourceFile);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue