From f96d71f32d670d11ef1363443165922f8f5988f1 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 8 Apr 2014 12:41:38 +0200 Subject: [PATCH] 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. --- app/src/processing/app/Base.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index d4b567fce..5757b5a73 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -456,22 +456,21 @@ public class Base { showError(null, _("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3); for (String path: filenames) { + // Correctly resolve relative paths + File file = absoluteFile(path); + // Fix a problem with systems that use a non-ASCII languages. Paths are // being passed in with 8.3 syntax, which makes the sketch loader code // unhappy, since the sketch folder naming doesn't match up correctly. // http://dev.processing.org/bugs/show_bug.cgi?id=1089 if (isWindows()) { try { - File file = new File(path); - path = file.getCanonicalPath(); + file = file.getCanonicalFile(); } catch (IOException e) { e.printStackTrace(); } } - // Correctly resolve relative paths - File file = absoluteFile(path); - boolean showEditor = (action == ACTION.GUI); if (handleOpen(file, nextEditorLocation(), showEditor) == null) { String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);