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.
This commit is contained in:
Matthijs Kooijman 2014-04-08 12:41:38 +02:00 committed by Cristian Maglie
parent 31fe4ac0c2
commit f96d71f32d
1 changed files with 4 additions and 5 deletions

View File

@ -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);