Skip to content

Commit f96d71f

Browse files
matthijskooijmancmaglie
authored andcommitted
Fix --curdir on Windows
On Windows, files are canonicalized to prevent issues with legacy 8.3 filenames. However, this canonicalization includes making the path absolute and this happened before applying --curdir to the path, making the latter a noop. By reversing the operations, this should allow both of them to do their work.
1 parent 31fe4ac commit f96d71f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/src/processing/app/Base.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -456,22 +456,21 @@ public Base(String[] args) throws Exception {
456456
showError(null, _("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3);
457457

458458
for (String path: filenames) {
459+
// Correctly resolve relative paths
460+
File file = absoluteFile(path);
461+
459462
// Fix a problem with systems that use a non-ASCII languages. Paths are
460463
// being passed in with 8.3 syntax, which makes the sketch loader code
461464
// unhappy, since the sketch folder naming doesn't match up correctly.
462465
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
463466
if (isWindows()) {
464467
try {
465-
File file = new File(path);
466-
path = file.getCanonicalPath();
468+
file = file.getCanonicalFile();
467469
} catch (IOException e) {
468470
e.printStackTrace();
469471
}
470472
}
471473

472-
// Correctly resolve relative paths
473-
File file = absoluteFile(path);
474-
475474
boolean showEditor = (action == ACTION.GUI);
476475
if (handleOpen(file, nextEditorLocation(), showEditor) == null) {
477476
String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);

0 commit comments

Comments
 (0)