New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Path action update #331
Conversation
Hmm, why not make this behavior the default and keep the old behavior as alternate action? |
I’m not opposed to that. I assume it will be something like “Get Literal Path” in English. What do you suggest for the German localization? |
The current is "Pfad (POSIX)" so I would suggest "Vollständiger Pfad (POSIX)" which is kind of "Get Full Path" as opposed to the abbreviated ~ path. |
Well, just had a quick play seems like Quicksilver doesn't understand the Try typing (in text mode) '~/' I suppose we could change the string sniffing again to resolve ~/ file On 27 May 2011 04:34, skurfer <
|
Thanks. I’ll probably go with “Get Absolute Path” for the English. That seems to be the most technically correct. Let me know if that changes your suggestion for German. @pjrobertson, can you give me the French?
Well, you can do plenty with it as a string (paste, type, Large Type, etc.) but it’s true you can’t do file stuff with it, like Open. I would say “Why get the path from a file object if you just want to use it as a file object in the first place?” but I have personally used the Open action on such a string, so I know there’s a use case. Also, it would be nice it you could type a relative path by hand and use file actions on it. I think we’d just need to modify string handling to check for strings starting with |
Absolute is 'absolu', so it's a pretty easy one in French :) 'Obtenir le chemin absolu' Not really sure how it could be shortened, so I hope that's OK. On the resolving ~/ strings as files, I've done some debugging, and it seems there are two problems woops - done your dirty work for you :) Change line 87 to this, and QS'll now resolve ~/ file paths fine :)
|
While you're at it, I'd also suggest changing lines 50+ of NSArray_BLTRExtensions.m to use fast enumeration
Or if you want I can do this along with all the other for i,j loops in one pull request |
Added some commits for the actions. I’m going to work on the string handling now. Also, |
OK, so this request has suffered a bit of scope creep, but I think it’s good to go now. I’ve made all the suggested changes. If anyone wants to provide additional localizations (for descriptions and command strings), post them here and I’ll add them. |
OK, that would make it "Absoluter Pfad (POSIX)" in German if you want to change it again. |
Couple of things: Where you've used the I think you should look at trying to keep the name of the existing action the same (getFilePosixPath) and just add a new action with a new name (so basically revert bb1fc17 ) |
I saw that but line 96 sets it to an
I ran into the same thing but I don’t see a way around it. A path beginning with I’d even argue that this is less disruptive to users. Neither action is enabled by default, so if you enabled Get Path at some point, you’ll now have Get Absolute Path enabled and Get Path disabled, but…
So to the user it appears as a simple rename. |
No, since NSMutableArray is a sub class of NSArray and any NSMutableArray will inherit all the mothods. Since the `arrayByPerformingSelector' isn't a method from the NSArray class (we defined it), NSMutableArrays don't inherit it, hence the warning. You basically just need to tell the compiler: yeah, this is also a method for an NSMutableArray as well as an NSArray (...I think. Makes sense to me - plus the compiler doesn't give a warning later on!)
Yeah alright. I've come round to your way of thinking :) I'd say cast the NSMutableArray in both the times you've used arrayByPerformingSelector then this'll be good to merge |
I made the suggested change. |
return pathResult; | ||
} | ||
|
||
- (QSObject *)getAbsoluteFilePaths:(QSObject *)dObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to come late with this but since the method bodies of getFilePaths
and getAbsoluteFilePaths
only differ by the first line it may be worthwhile to factor out the common remainder into a separate method. But this can also be done independently from this pull...
Sorry to be a pain Rob, but turns out I was wrong on the casting business :( Here's what @neurolepsy said: it would work, but that shouldn't be how it's fixed. Perhaps db4011f should be reverted, then the two I'd also seen what @fheckl has said, and thought the same thing. Do you think it's worth changing it in this pull? It'd mean we could 'forget' about this once and for all (hopefully!) once it's done. |
I put the duplicated code into a single method as suggested by @fheckl and changed the return type for the |
Don't forget to change the .h file.. ;-) Almost ready to pull :D |
Duh! Thanks. |
Seems good now. If @fheckl has nothing more to say, either of us can merge it :) |
No, nothing more from my side. Let's end the pain.
This could be controversial, so I’m just putting it out there for discussion.
I found myself using this action mostly in support e-mails where you want to refer a user to
~/Library/Application Support/Quicksilver/PlugIns
or something like that. It annoyed me that I had to replace/Users/rob
with~
so frequently. The literal path has never once been what I wanted, and almost everything I Get Path on is in my home directory.So my first thought was to create another action to get the
~
path and also make it an alternate for Get Path, but then I thought “Why?”. The~
path will work in any context where you might use the literal path (a script or something) and like I said, I never want the other form (but that could be just me).Note that this change has no effect on paths outside the current user’s home.