Skip to content

Commit

Permalink
Force aya working dir to be an absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
np-soartech committed Dec 1, 2022
1 parent dcf9f77 commit a76804d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/aya/AyaPrefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ private static void initWorkingDir() {
workingDir = workingDir.substring(0, ix+1);
}

workingDir = (new File(workingDir).toPath()).toString() + File.separator;
workingDir = (new File(workingDir).getCanonicalPath()).toString() + File.separator;
} catch (URISyntaxException e) {
workingDir = "";
Aya.getInstance().printDebug("Cannot locate working dir");
} catch (IOException e) {
workingDir = "";
Aya.getInstance().printDebug("Cannot locate working dir");
}
defaultWorkingDir = workingDir;
}
Expand Down Expand Up @@ -72,9 +75,10 @@ public static boolean setWorkingDir(String workingDir) {
}
try {
//Create a path to test if it exists
File fwd = new File(workingDir);
Path path = new File(workingDir).toPath();
if (Files.exists(path)) {
AyaPrefs.workingDir = path.toString() + File.separator;
AyaPrefs.workingDir = fwd.getCanonicalPath() + File.separator;
return true;
} else {
//System.out.println("setWorkingDir: error, dir does not exist: " + workingDir);
Expand Down

0 comments on commit a76804d

Please sign in to comment.