Jump to content

Javascript files are being identified as public.folder by macOS (so don't work in a folder filter in Alfred)


Recommended Posts

5 hours ago, Vero said:

Step one is to rebuild your Mac's index

 

Doing that now. One thing I want to note is that when I ticked this box:

 

1786140085_2018-11-06at14_58.png.d2fc28f4c396561dbdd0edadce1c459a.png

 

When it tried to rm it, terminal said `permission denied` even though I wrote my sudo password. Perhaps that's due to SIP. Maybe it's something that should be noted?

Link to comment

@nikivi Grab the Alfred Metadata tool here and drag some of your .ts and .js files to work out what their file types are:

https://cachefly.alfredapp.com/tools/AlfredMetadataTool_v1.1.zip

 

Paste the results so we can see what file types are listed in the metadata, and whether that's why they're returned.

 

Next, copy just the File Filter object from your workflow, set a new keyword, and try using just that object (let's say, with a Reveal in Finder action added to the end)? 

 

Removing all your scripts that surrounds it will ensure results down to exclusively what the File Filter is returning, rather than anything that's then passed through scripts.

 

Cheers,
Vero

Link to comment

A JS file

 

/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/bs-platform/lib/amdjs/unix.js
Internal File Metadata
======================
 Display Name: unix.js
    Alt Names: 
    File Type: public.folder
     Comments: 
     Keywords: 
    Last Used: 
Raw mdls File Metadata
======================
kMDItemContentCreationDate         = 2018-11-06 00:46:11 +0000
kMDItemContentCreationDate_Ranking = 2018-11-06 00:00:00 +0000
kMDItemContentModificationDate     = 2018-11-06 00:46:11 +0000
kMDItemContentType                 = "public.folder"
kMDItemContentTypeTree             = (
    "public.item",
    "public.folder",
    "public.directory"
)
kMDItemDateAdded                   = 2018-11-06 00:46:11 +0000
kMDItemDateAdded_Ranking           = 2018-11-06 00:00:00 +0000
kMDItemDisplayName                 = "unix.js"
kMDItemFSContentChangeDate         = 2018-11-06 00:46:11 +0000
kMDItemFSCreationDate              = 2018-11-06 00:46:11 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "unix.js"
kMDItemFSNodeCount                 = (null)
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 501
kMDItemFSSize                      = 59031
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2018-11-06 00:00:00 +0000
kMDItemKind                        = "Folder"
kMDItemLogicalSize                 = 59031
kMDItemPhysicalSize                = 61440

 

 

Link to comment
6 hours ago, nikivi said:

A JS file


/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/bs-platform/lib/amdjs/unix.js
Internal File Metadata
======================
 Display Name: unix.js
    Alt Names: 
    File Type: public.folder

 

 

Anything look funny to you, Niki?

Edited by deanishe
Remove excess space
Link to comment
3 hours ago, deanishe said:

 

Forgive me for perhaps a silly question but I read through that document few times and I don't get how do I find what app defines JavaScript files? Is it the app that is set to default open the file type? 

 

So in my case I'd run:

 

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u /Applications/Visual\ Studio\ Code.app

Link to comment
15 minutes ago, nikivi said:

I don't get how do I find what app defines JavaScript files?

 

My system shows JS files as having the UTI com.netscape.javascript-source. So you should grep your /Applications directory for com.netscape.javascript-source to see which app defines that UTI. On my machine, that would be BBEdit, VimR, VoodooPad and TextMate. Installing (and running) one of those apps might also fix your problem.

 

VS Code supports .js files, but it doesn't define a UTI for them, so that likely won't work.

 

(This stuff is all defined in an app's info.plist.)

Edited by deanishe
Link to comment

I got this (rg is ripgrep).

 

/Applications
❯ rg com.netscape.javascript-source
Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Versions/A/Resources/StandardFileTypes.xcspec
381:        UTI = "com.netscape.javascript-source";
Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source


```

 

Neither of these are apps it seems. Going to install BBEdit and open .js file .d.ts and .ts files and hope that fixes it.

Link to comment
10 minutes ago, deanishe said:

Try re-registering BBEdit with lsregister

 

Tried that. Didn't help.

 

10 minutes ago, deanishe said:

 

I don't have LaunchServices.framework in Frameworks so I can't run the mentioned in that article command.

 

1561175655_2018-11-07at00_51.png.cb02fc965ea9f64782c82c350a35b0ee.png

 

I can try run:

 

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

 

But I want to make sure that it would do the same thing. Is it safe to run?

Edited by nikivi
Link to comment
  • Andrew changed the title to Javascript files are being identified as public.folder by macOS (so don't work in a folder filter in Alfred)
5 hours ago, dfay said:

use the instructions linked here to rebuild LS

 

Didn't help sadly:

 

1284257398_2018-11-08at17_51.png.cb0a00105777f40c8b02f248db789807.png

 

The file types are all still public.folder.

 

/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/reason-apollo/lib/bs/src/ApolloClient.mlast.d
Internal File Metadata
======================
 Display Name: ApolloClient.mlast.d
    Alt Names: 
    File Type: public.folder
     Comments: 
     Keywords: 
    Last Used: 
Raw mdls File Metadata
======================

 

Is the only other solution to format my disk?

Edited by nikivi
Link to comment

It could be that one of the apps that you have installed is defining that JS files to be of type public folder, and even rebuilding the launch services database won't fix things because of whichever app this is.

 

The first answer on here gives more info to save me typing more about this:

https://superuser.com/questions/263311/on-os-x-how-do-you-change-a-files-kind

 

If you could work out which app it is and delete that app, you may have more luck when trying to re-associate these files.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...