Merge lp:~nmb/bzr-explorer/quote-commands-osx into lp:bzr-explorer

Proposed by Neil Martinsen-Burrell
Status: Merged
Merged at revision: not available
Proposed branch: lp:~nmb/bzr-explorer/quote-commands-osx
Merge into: lp:bzr-explorer
Diff against target: 26 lines (+6/-1)
2 files modified
NEWS (+5/-0)
lib/explorer.py (+1/-1)
To merge this branch: bzr merge lp:~nmb/bzr-explorer/quote-commands-osx
Reviewer Review Type Date Requested Status
Ian Clatworthy Needs Fixing
Review via email: mp+18387@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

This fixes a couple of problems with looking up applications for editors on OS X.

1) open -a automatically looks in /Applications and its subfolders so specifying "/Applications" directly breaks applications in e.g. /Applications/Microsoft Office

2) Spaces weren't quoted so applications such as "Microsoft Excel.app" didn't work.

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Thanks for the patch. It's not quite ready to land though ...

1. This breaks backwards compatibility for anyone who has configured editors previously. At a minimum, please update NEWS with an item in a section called "Compatibility breaks" (which should go first in the list of sections).

2. The comments and settings in skin/editors.conf need updating as well, e.g. Gimp.app -> /Applications/Gimp.app.

Alternatively, maybe introduce a method called appname_to_path() and let it decide whether to return /Applications/%s or "/Applications/%s", depending on whether appname has a space or not.

review: Needs Fixing
Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

I don't think I understand your concerns about compatibility. "open -a Gimp.app" *does* open /Applications/Gimp.app. If someone had the setting "xyz = QRS.app" before which was opening /Applications/QRS.app because that path was specified in the string interpolation, then with this change, it will *still* open /Applications/QRS.app.

Thus, there is no compatibility break and no need to update skin/editors.conf. (The only possible exception is people who were using settings like "xyz = QRS.app -n -g Something.app" to mean "open -a /Applications/QRS.app -n -g Something.app other_file" [since the command has to end in ".app" to be interpolated]. This is an extremely convoluted example because it means that the application QRS.app has to be able to open the app bundle Something.app as well as other_file. The only solution to such a convoluted example is to not make this change and to figure out the quoting that needs to be applied in editors.conf to get quotes in the interpolated command name.)

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Neil Martinsen-Burrell wrote:
> I don't think I understand your concerns about compatibility. "open -a Gimp.app" *does* open /Applications/Gimp.app. If someone had the setting "xyz = QRS.app" before which was opening /Applications/QRS.app because that path was specified in the string interpolation, then with this change, it will *still* open /Applications/QRS.app.

Ah - ok. I'll go ahead and land it. Apologies.

Ian C.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-01-31 06:40:56 +0000
3+++ NEWS 2010-02-01 14:48:15 +0000
4@@ -32,6 +32,11 @@
5 * A custom switch dialog is now provided that makes switching between
6 branches in a colocated workspace easier. (Neil Martinsen-Burrell)
7
8+Bug fixes:
9+
10+* Allow spaces in command names on Mac OS X.
11+ (Neil Martinsen-Burrell, #515514)
12+
13 Translations:
14
15 * Added translations for Hebrew and Hungarian.
16
17=== modified file 'lib/explorer.py'
18--- lib/explorer.py 2010-01-31 04:34:58 +0000
19+++ lib/explorer.py 2010-02-01 14:48:15 +0000
20@@ -113,7 +113,7 @@
21 elif sys.platform == 'darwin':
22 # Map xx.app -> "open -a /Applications/xx.app"
23 if command.endswith(".app") and not command.startswith("open"):
24- command = "open -a /Applications/%s" % command
25+ command = 'open -a "%s"' % command
26 return shlex_split_unicode(command)
27
28

Subscribers

People subscribed via source and target branches