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
Always store UTIs for include/exclude types in FieSystemObjectSources (supersedes #1681) #1708
Conversation
OK, I’ll give this a try. What would happen if you store the |
Dunno, I’d let the OS handle that - hopefully it’s clever enough You could test it:
On 6 Rhag 2013, at 12:05, Rob McBroom notifications@github.com wrote:
|
and… drum roll… storing a dyn- UTI and later checking it for conformance with a real UTI doesn’t work. See the latest few commits for a fix for that - I had to create a better UTTypeConformsTo function ;-) Good spot/idea On 6 Rhag 2013, at 12:16, Patrick Robertson robertson.patrick@gmail.com wrote:
|
Well, I don't like I also think you could make it an internal (eg. I'm also surprised by the conforming check failing, because that's the whole point of UTI. So either the OS bugs out (and your workaround is fine), or we're generating the UTI wrong in the first place... I'm currently working again on my UTI unpacker — as soon as I have that ready, we'll be able to understand what EDIT: Have you checked that LaunchServices registered the new UTI ? (search |
Yep, me too. You’ll see from my previous comment that I said “The OS should take care of that - that’s the whole point of UTIs"… but it doesn’t
Yes, it’s fragile, but for now it’s the best we’ve got. How would you determine if something’s a UTI? :/ On 6 Rhag 2013, at 19:24, Etienne Samson notifications@github.com wrote:
|
I'm just wary of what others application will declare as UTIs — suppose the guy who exports "sillyextension" doesn't use the recommended reverse DNS notation. If you want some cold hard proofs, you should get a look at the output of
I'm pretty sure there's a good reason ;-). UTIs are tree-based, and maybe having one single tree would have imposed too much burden when doing lookups or something else (like, it wouldn't account for the case when someone wants it's own root UTI, like, "qs.object", if you see where I'm heading ;-)).
I'm also dubious on that one (not about your work, but as the saying more-or-less goes, "If there's a bug in the OS, it's likely in your application" ;-)). I plan on juggling that UTI problem, but I was just wondering if the behavior changes if you pass a "conformingTo" UTI to |
Off out, but I thought I’d do this quickly before I left. Maybe it needs some work, but you get the point ;-) On 6 Rhag 2013, at 20:07, Etienne Samson notifications@github.com wrote:
|
Ok, now my eyes are open, and this is a mess... Here's your modified project : https://www.dropbox.com/s/vkbozkfp2jec1rb/UTITest%202.zip
EDITED |
Hehe, I’m glad I’ve given you something fun to play with* :P
FYI that’s what we’re currently using in Quicksilver. I wanted to move to using just the NSURL method, but of course that only works for files
On 6 Rhag 2013, at 21:48, Etienne Samson notifications@github.com wrote:
|
P.S. I think we should register is.patrick.sillyfile globally :) On 6 Rhag 2013, at 23:49, Patrick Robertson robertson.patrick@gmail.com wrote:
|
Yep, just to get the
Which is the majority of the use cases as of now (there's no API in Cocoa that works like Given the few gotchas above, I'm not sure it's reliable enough. I haven't been able to reproduce the
Yeah, I used the bundle ID, but the name sound cool ;-). |
OK @tiennou, this post may be of interest to you: http://webcache.googleusercontent.com/search?q=cache:zHQtElQ9KlAJ:alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why+&cd=5&hl=en&ct=clnk&gl=uk (seems like the actual page isn't loading right now) The reason the generated I still think this is perfectly fine to be merged (Except for the conflict now of course) - are people still not happy with the |
OK, I'm 100% happy with my If people are stupid enough to define their own custom UTI that doesn't use the reverse DNS/dot syntax then their apps will not work. Apple seems to laugh at these people. Using the UTITest app above, I did the following:
So this goes to show that UTIs won't work if they don't use the reverse DNS, so we don't need to worry about that use case :) |
Yeah, I pointed that post in IRC a few months ago (I'm still trying to write an UTI unpacker because of that, but I'm stuck at the "custom" base32 decoding part). You're right, they're different because they contain different stuff. I'm still a little unsure about the "works fine" part though, but I'm too time-constrained atm so I'll keep my "not-happyiness" for the being ;-). Also, since I started to comment, I found out about the |
…rlier versions of QS
… they don't have an associated extension)
OK to test |
For some UTIs (like com.apple.xcode.project) the description of the UTI is 'content'. Not very helpful
file extensions on folders can be misleading. Fixes #1742
// Try to get the UTI from the extension/string | ||
if ([editingString hasPrefix:@"'"]) { | ||
// 'xxxx' strings are OS types | ||
NSString *OSTypeAsString = [editingString stringByReplacingOccurrencesOfString:@"'" withString:@""]; |
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.
This should be using stringByTrimmingCharactersInSet:
, too. Then, I think this can be merged.
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.
OK done. If/when I implement a QSUTIManager
singleton class this'll be something else it'll do. I've made a note of it in a comment, you'll see
Always store UTIs for include/exclude types in FieSystemObjectSources (supersedes #1681)
See #1681 for more of the discussion
Instead of fiddling with UTIs in the
QSDirectoryScanner
, I think it's much more wise to just always store the UTI for the include/exclude types option (be itdyn-xxx
or not)This has some fancy benefits of being able to show the nice name for OSTypes (e.g. if you enter
'fold'
you'll seefolder
in the token, instead of'fold'
like it used to be, and also you can see the UTI from the popup of the menu item (just like I've done for the bundle ID for trigger scope)