fix: :config_edit open editor not video player#269
fix: :config_edit open editor not video player#269suveshmoza wants to merge 3 commits intoglide-browser:mainfrom
Conversation
| const mime_info = mime_service.getFromTypeAndExtension("text/plain", ""); | ||
| mime_info.preferredAction = Ci.nsIHandlerInfo.useSystemDefault; | ||
| mime_info.launchWithFile(file); | ||
| } catch { |
There was a problem hiding this comment.
q: did you run into any errors while testing this or is this just defensive?
There was a problem hiding this comment.
Just being defensive here. I didn’t run into any errors during testing, but added in case it throws.
| function launch_as_text(file: nsIFile): void { | ||
| try { | ||
| const mime_service = Cc["@mozilla.org/mime;1"]!.getService(Ci.nsIMIMEService); | ||
| const mime_info = mime_service.getFromTypeAndExtension("text/plain", ""); |
There was a problem hiding this comment.
I know at least on macOS you can register different editors for different kinds of text files... so I suspect we'll have to try a more specific mime type first.
There was a problem hiding this comment.
Found the full list of MIME types https://www.iana.org/assignments/media-types/media-types.xhtml
. I think the javascript/ecmascript mime type should do the work
|
Okay I think we don't need to worry about windows really. It seems like they only support setting default applications per file extension, and if one isn't explicitly set then it prompts you to choose an application. The only failure case then is if someone has already set a media player as the default for .ts files, but that seems unavoidable? |
7209d74 to
d03974f
Compare
Yes |
Closes #228
Test on