-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
🎉 Check for WScript.exe #1872
🎉 Check for WScript.exe #1872
Conversation
c78f034
to
2455c78
Compare
@@ -52,7 +51,7 @@ module.exports = function () { | |||
label: 'Preferences...', | |||
accelerator: accelerators.preferences, | |||
click() { | |||
shell.openItem(confPath); | |||
openConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the same onpenConfig()
function here: https://github.com/zeit/hyper/blob/3c1f359198a71c6946f326bfda3e53f612ade23e/app/menus/menus/darwin.js#L21 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep fixed @chabou 👌
I really love this solution! ❤️ |
const {shell} = require('electron'); | ||
const {confPath} = require('./paths'); | ||
|
||
module.exports = () => Promise.resolve(shell.openItem(confPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there 2 module.exports
in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we want to have a different module on windows compared to others
if (error) { | ||
reject(error); | ||
} else if (stdout && stdout.includes('WScript.exe')) { | ||
reject(new Error('WScript is the default editor for .js files')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If WScript.exe
exists, this will throw an error, which will then open the conf file with notepad? I thought the idea is to use WScript.exe
if it exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnguyen14 No, WScript.exe
run the file instead of editing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will check if your default editor is set to WScript.exe, if it is , it will use notepad.exe, since WScript.exe isn't an editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I see. I understand now. Thank you for the clarification. I was confused by this comment: Windows opens .js files with WScript.exe by default
Does not work on Windows, even though a default program other than WScript is set for .js, it opens notepad. |
I've got a bit of a problem here in that you can manually change filetype associations like this:
but then hyper won't start any more. So without a configuration option to change what editor opens the configuration file, I'm stuck with notepad. Any suggestions? |
This is my proposed solution for handling #1812
We could add a key in the config for setting the editor, but I think that's a bad idea. Better to teach the users to set the correct app for .js files :) maybe put an alert/dialog with a link on how to do it.
At least this will let people open their config without errors, and we can think about how we can make this better in the future
Fixes #1812 #1810 #1784 (comment) #1854