Don't add quotes if the file name already has quotes (#40)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e0bb6f..c0e8db8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### 3.0.11
+
+* Fix bug: don't add quotes if the file name already has quotes.
+
#### 3.0.10
* Added quoted strings to indicate where the command name ends and the arguments
diff --git a/lib/src/interface/common.dart b/lib/src/interface/common.dart
index 481c082..2e711c1 100644
--- a/lib/src/interface/common.dart
+++ b/lib/src/interface/common.dart
@@ -26,7 +26,7 @@
if (!platform.isWindows) {
return executable;
}
- if (executable.contains(' ') && !executable.startsWith('"')) {
+ if (executable.contains(' ') && !executable.contains('"')) {
// Use quoted strings to indicate where the file name ends and the arguments begin;
// otherwise, the file name is ambiguous.
return '"$executable"';
diff --git a/pubspec.yaml b/pubspec.yaml
index c9f5ad2..1868658 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: process
-version: 3.0.10
+version: 3.0.11
authors:
- Todd Volkert <tvolkert@google.com>
- Michael Goderbauer <goderbauer@google.com>
diff --git a/test/src/interface/common_test.dart b/test/src/interface/common_test.dart
index 7f4dfc6..6d465a6 100644
--- a/test/src/interface/common_test.dart
+++ b/test/src/interface/common_test.dart
@@ -204,6 +204,14 @@
sanitizeExecutablePath('"Program Files\\bla.exe"',
platform: platform),
'"Program Files\\bla.exe"');
+ expect(
+ sanitizeExecutablePath('\"Program Files\\bla.exe\"',
+ platform: platform),
+ '\"Program Files\\bla.exe\"');
+ expect(
+ sanitizeExecutablePath('C:\\\"Program Files\"\\bla.exe',
+ platform: platform),
+ 'C:\\\"Program Files\"\\bla.exe');
});
});