Skip to content

Commit

Permalink
Better change working directory semantics for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
david-schmidt committed Sep 13, 2020
1 parent 7f9234a commit 990b062
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/org/adtpro/gui/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,13 @@ public byte setWorkingDirectory(String cwd)
byte rc = 0x06; // Unable to change directory message at Apple
cwd = cwd.trim();
File parentDir;
if (cwd.equals("/") || cwd.equals("\\"))
File cwdDir = new File(cwd);
Log.println(false, "Gui.setWorkingDirectory() incoming: " + cwd);
if (cwdDir.isAbsolute())
parentDir = null;
else
parentDir = new File(_workingDirectory);
if ((cwd.startsWith("/") || cwd.startsWith("\\")))
parentDir = null;
Log.println(false, "Gui.setWorkingDirectory() parentDir: "+parentDir);

File baseDirFile = new File(parentDir, cwd);
String tempWorkingDirectory = null;
Expand Down Expand Up @@ -573,9 +574,12 @@ public byte setWorkingDirectory(String cwd)
_workingDirectory = _workingDirectory + File.separator;
}
_workingDirectory = tempWorkingDirectory;
Log.println(false, "Gui.setWorkingDirectory() saving: " + _workingDirectory);
saveProperties();
rc = 0x00;
}
else
Log.println(false, "Gui.setWorkingDirectory() unable to make that change.");
return rc;
}

Expand Down

0 comments on commit 990b062

Please sign in to comment.