Sublime Forum

How avoiding PDF files are opened in ST?

#1

Hi there! Recently some PDFs are being opened with Sublime Text, I am researching but I am not able to give them up opening with it, Can anyone help? Thanks!

0 Likes

#2

You mean you’ve associated Sublime Text to be the default application for opening PDF files? What platform (OS) are you on?

0 Likes

#3

The problem only happens with the PDFs from a ELT app. The rest of PDFs are always opening with Acrobat, but I am not sure why only these PDFs are opening with Sublime Text.

I work on macOS Sierra and ST 3 B 3152. I was researching on the website and installed the “Non Text Files” plugin from Package Control, but I am new in this field and I think I am doing sth wrongly.

0 Likes

#4

The problem has nothing to do with ST, so give up on that.

The app at fault is the one creating the files (the ELT app as you call it). You can try the following with one of the files created by that app:

  • control-click or right click and select Get Info to display the info window
  • under the Open With section select something other than ST
  • click the Change All… button to make sure all such files are opened with the app you chose.

That may not work if the app in question is forcing the “owner” of the file to ST (maybe it was convenient for them for debugging purposes, who knows). In that case you have to talk to them about the problem.

0 Likes

#5

Thank you very much for your reply and help, but I knew this option, so I checked that all PDF’s were set up to be opened with Acrobat. If I removed ST from my computer, they would be opened correctly with Acrobat. But this cannot be the solution.

As I said previously, perhaps I might try with the “Non Text Files” plugin from Package Control?? I am new with this tool and I am not sure if it can work and how, I followed the instructions but I didn’t get it. According to the description, it would avoid opening these files (PDFs) with ST. What do you think? Thanks for helping!

https://packagecontrol.io/packages/Non%20Text%20Files

0 Likes

#6

As I said, the problem isn’t with ST. You’re assuming that file extensions alone determine file type on macOS, but they don’t, so those files with a PDF extension can have another type. So although those ELT app files look like PDF files, have PDF content and a PDF extension, they have been given another (“more specific”) file type which is associated with ST. When ST isn’t installed, it goes to the next most specific type is has, which is PDF which is associated with Acrobat. Files actually have a tree of types associated with them.

Have a read of this:

Use the mdl` utility in terminal to get detailed info on the files being created by the ELT app.

Here is an example of two files in the same directory on my disk with the same extension but different types and different “Open With” info. This is the output from mdls:

$ mdls /dev/data/streamf/impl/DataQB.m3 _kMDItemOwnerUserID = 501 kMDItemContentCreationDate = 2016-01-19 16:32:09 +0000 kMDItemContentModificationDate = 2017-10-18 12:33:09 +0000 kMDItemContentType = "com.apple.traditional-mac-plain-text" kMDItemContentTypeTree = ( "com.apple.traditional-mac-plain-text", "public.plain-text", "public.text", "public.data", "public.item", "public.content" ) kMDItemDateAdded = 2016-12-18 22:42:52 +0000 kMDItemDisplayName = "DataQB.m3" kMDItemFSContentChangeDate = 2017-10-18 12:33:09 +0000 kMDItemFSCreationDate = 2016-01-19 16:32:09 +0000 kMDItemFSCreatorCode = "CWIE" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = (null) kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = (null) kMDItemFSLabel = 0 kMDItemFSName = "DataQB.m3" kMDItemFSNodeCount = (null) kMDItemFSOwnerGroupID = 70 kMDItemFSOwnerUserID = 501 kMDItemFSSize = 9530 kMDItemFSTypeCode = "TEXT" kMDItemKind = "SimpleText Document" kMDItemLogicalSize = 9530 kMDItemPhysicalSize = 16384
$ mdls /dev/data/streamf/impl/DataQPush.m3 _kMDItemOwnerUserID = 501 kMDItemContentCreationDate = 2016-12-18 00:19:17 +0000 kMDItemContentModificationDate = 2017-10-18 12:30:17 +0000 kMDItemContentType = "dyn.ah62d4rv4ge804q2" kMDItemContentTypeTree = ( "dyn.ah62d4rv4ge804q2", "public.data", "public.item" ) kMDItemDateAdded = 2016-12-18 00:19:17 +0000 kMDItemDisplayName = "DataQPush.m3" kMDItemFSContentChangeDate = 2017-10-18 12:30:17 +0000 kMDItemFSCreationDate = 2016-12-18 00:19:17 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = (null) kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = (null) kMDItemFSLabel = 0 kMDItemFSName = "DataQPush.m3" kMDItemFSNodeCount = (null) kMDItemFSOwnerGroupID = 70 kMDItemFSOwnerUserID = 501 kMDItemFSSize = 1764 kMDItemFSTypeCode = "" kMDItemKind = "Document" kMDItemLogicalSize = 1764 kMDItemPhysicalSize = 4096

1 Like