Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/glide/browser/base/content/browser-excmds.mts
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ class GlideExcmdsClass {

const file = Cc["@mozilla.org/file/local;1"]!.createInstance(Ci.nsIFile);
file.initWithPath(GlideBrowser.config_path);
file.launch();
launch_as_text(file);
break;
}

Expand Down Expand Up @@ -1042,3 +1042,14 @@ export function get_command_info(
}

export const GlideExcmds = new GlideExcmdsClass();

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", "");
mime_info.preferredAction = Ci.nsIHandlerInfo.useSystemDefault;
mime_info.launchWithFile(file);
} catch {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: did you run into any errors while testing this or is this just defensive?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being defensive here. I didn’t run into any errors during testing, but added in case it throws.

file.launch();
}
}