Skip to content
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

Is this meant to work for all files that aren't associated with other QL plugins? #111

Open
ghost opened this issue Dec 22, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 22, 2020

I thought this plugin was meant to quicklook all files as text, if they don't have their own plugin already.

I have already found many files for which this doesn't work.

So I ask, what is the purpose of this plugin? Does it truly only support files it has been programmed to support, and not arbitrary "unseen" filetypes?

@cipri-tom
Copy link

cipri-tom commented Jun 11, 2021

Reading this source code

if (!magicAttributes) {
NSLog(@"QLStephen: Could not determine attribtues of file %@", url);
return noErr;
}
if (!magicAttributes.isTextFile) {
return noErr;
}

and this:

task.launchPath = @"/usr/bin/file";
task.arguments = @[@"--mime", @"--brief", path];

and

NSArray *components = [mimeType componentsSeparatedByString:@"/"];
if (components.count != 2)
return NO;
if ([components[0] rangeOfString:@"text"].location != NSNotFound)
return YES;

It seems that it relies on the /usr/bin/file program to return a MIME type that contains text. If file --mime does not return text/... for your file, then qlstephen will not try to render it


For example, for a yadayada.geojson file, running file --mime --brief yadayada.geojson returns application/json; charset=us-ascii. Since text is not part of that, it is not rendered by QLStephen 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant