# HG changeset patch # User Vladimir Kvashin # Date 1261673107 -10800 # Node ID 8aba1fcd9d5772c9190a2cc5f342e870a1f16d11 # Parent 8efb87ff3162f4cd95870e6de234a33b1c1e8682 fixed #178201 Run fails if 'Show profiling indicators' is off and the project is created in folder with space diff -r 8efb87ff3162 -r 8aba1fcd9d57 cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/DefaultProjectActionHandler.java --- a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/DefaultProjectActionHandler.java Mon Dec 21 17:28:46 2009 +0300 +++ b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/DefaultProjectActionHandler.java Thu Dec 24 19:45:07 2009 +0300 @@ -174,7 +174,18 @@ !exe.endsWith(".exe")) { // NOI18N exe = exe + ".exe"; // NOI18N } - args = MessageFormat.format(pae.getProfile().getTerminalOptions(), rcfile, exe, args, args2); + // fixing #178201 Run fails if 'Show profiling indicators' is off and the project is created in folder with space + StringBuilder b = new StringBuilder(); + for (int i = 0; i < exe.length(); i++) { + if (exe.charAt(i) == '"') { + b.append("\\\""); // NOI18N + } else { + b.append(exe.charAt(i)); + } + } + String exe2 = b.toString(); + + args = MessageFormat.format(pae.getProfile().getTerminalOptions(), rcfile, exe, args, args2, exe2); exe = pae.getProfile().getTerminalPath(); } } diff -r 8efb87ff3162 -r 8aba1fcd9d57 cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/runprofiles/RunProfile.java --- a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/runprofiles/RunProfile.java Mon Dec 21 17:28:46 2009 +0300 +++ b/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/runprofiles/RunProfile.java Thu Dec 24 19:45:07 2009 +0300 @@ -199,6 +199,13 @@ String name; String termPath; + // Format string arguments: + // 0 - file to store return code + // 1 - executable name (quated if need, i.e. if it contains spaces, asterisks, etc.) + // 2 - args (quated if need, i.e. if it contains spaces, asterisks, etc.) + // 3 - the same as {3}, but quotes are escaped with '\' + // 4 - (added by VK: the same as {1}, but quotes are escaped with '\' + // fixing #178201 Run fails if 'Show profiling indicators' is off and the project is created in folder with space list.add(def); if (isWindows()) { String term = getString("TerminalType_CommandWindow"); // NOI18N @@ -220,7 +227,7 @@ list.add(name); termPaths.put(name, termPath); termPaths.put(def, termPath); - String opts = "--disable-factory --hide-menubar " + "--title=\"{1} {3}\" " + // NOI18N + String opts = "--disable-factory --hide-menubar " + "--title=\"{4} {3}\" " + // NOI18N "-x \"" + dorun + "\" -p \"" + getString("LBL_RunPrompt") + "\" " + // NOI18N "-f \"{0}\" {1} {2}"; // NOI18N termOptions.put(name, opts);