p2 / quicklook-csv

A QuickLook plugin for CSV files
Other
289 stars 22 forks source link

Stop creating an icon for every 'TEXT' file #5

Closed p2 closed 11 years ago

p2 commented 11 years ago

Original author: elmimmo@gmail.com (September 11, 2010 12:10:51)

Files edited with TextWrangler, which adds a 'TEXT' file type them, that do not have a common text file extension (such as .CUE) keep being identified by the Finder and Quicklook as CSV files. The icon that quicklook-csv creates does not apply, and Quicklook preview gets broken for them (since it tries to parse them as CSV).

CSV or TSV are obviously identified by their extension. For the love of god, limit quicklook-csv to those files with appropriate file name, and nothing else.

What steps will reproduce the problem?

  1. Create a text file, and assign it the .CUE file extension.
  2. Assign it the legacy filetype 'TEXT'. You can do so with A Better Finder Attibutes or editing and saving it with TextWrangler.
  3. Browse with the Finder to that folder, choose column view.
  4. Press spacebar to see the Quiclook preview

What is the expected output? What do you see instead?

In step 3 the icon reads CUE over CSV, and shows the file contents. In step 4 quicklook-csv renders the contents into rows trying to parse them as CSV.

Neither step 3 nor step 4 should have anything to do with quicklook-csv

What version of the product are you using? On what operating system?

quicklook-csv 1.1.1 on Mac OS X 10.6.4

Original issue: http://code.google.com/p/quicklook-csv/issues/detail?id=5

p2 commented 11 years ago

From phase.of.matter on October 07, 2010 10:20:05 Hmmm, yes, it "works" as you describe. As you can see from the Info.plist, quicklook-csv should restrict itself to files with a csv or tsv-extension, but it obviously doesn't. I suppose the behavior you find stems from the compatibility with FileMaker I introduced, despite the file in question having an UTI of "dyn.ah62d4um4ge80g7pf", which is NOT listed by quicklook-csv and therefore should NOT cause quicklook-csv to create an icon.

I'll need to investigate further.

p2 commented 11 years ago

From reeves.87 on November 25, 2010 01:51:16 FYI dyi. anything is a random auto generated UTI. You can not depend on them for reliable mapping of files any more the an DHCP generated ip address can be used as a reliable way of remotely connecting with a machine. They way stay constant for a long time but this not guaranteed to be to case even on the same machine. I found two such entries in your plist file. I don't know if its causing this particular problem but it will cause similar headaches in the future. The correct way of doing this is to define UTImportedTypeDeclarations in Info.plist. See http://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html for details. You may need to use to the lsregister command to get the mapping to update.

p2 commented 11 years ago

From phase.of.matter on November 25, 2010 07:39:53 @reeves.87:

The random UTIs you found are the ones that actually made this plugin work back in 10.5 when there was no UTI for CSV and TSV. They were the same for a lot of users and the only option to make this plugin work. See the Wiki of this project.

UTImportedTypeDeclarations are for Applications but irrelevant for QuickLook plugins, see http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Articles/QLProjectConfig.html#//apple_ref/doc/uid/TP40005020-CH5-SW5

In this issue, QuickLook uses two generators to produce a preview, which already by itself is a bug. Why QuickLook is used in the first place is unknown to me as the UTI that "qlmanage" gives me is not even supported by the plugin.

p2 commented 11 years ago

From reeves.87 on November 27, 2010 01:20:31 Sorry my brain went out the window. There is an alternative but no need to fix what isn't broken. In any case this problem is clearly unrelated.

p2 commented 11 years ago

From phase.of.matter on November 27, 2010 09:30:33 It was worth mentioning, made me check the plist again, maybe it would have led to something.

p2 commented 11 years ago

From chocolat...@gmail.com on August 27, 2011 23:26:17 Any update on this? For anyone that uses TextWrangler on a regular basis (and I bet, being free and still gorgeous) this is a pretty annoying issue.

p2 commented 11 years ago

From chocolat...@gmail.com on August 27, 2011 23:29:34 Seems to be fixable if one removes the following node from Info.plist

    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>tsv</string>
            <string>tab</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>FileMaker</string>
        <key>CFBundleTypeRole</key>
        <string>QLGenerator</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.traditional-mac-plain-text</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
        <key>NSPersistentStoreTypeKey</key>
        <string>XML</string>
    </dict>
p2 commented 11 years ago

From help.you.i.can@gmail.com on August 28, 2011 19:38:26 Well, "fixable" is the problem. If you remove this section, the plugin won't work anymore for FileMaker tab separated files. I would have to run some tests first, but I no longer have access to pre-10.7 machines so I fear of breaking it for those relying on it to display tab-separated files. On the other hand I could just update it for Lion-Users and state that it might brea for Tab-files pre 10.7. We'll see, I currently don't have time for this but will take a note, thanks!

p2 commented 11 years ago

From phase.of.matter on October 24, 2012 00:21:30 I can't reproduce this on 10.8, so for the sake of not breaking the plugin for FileMaker I won't take action on this.