mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Revert "Open Preferences in Default JS Editor on Windows" (#1510)
This commit is contained in:
parent
a2acccabe7
commit
d4c1d08701
1 changed files with 24 additions and 5 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
import os from 'os';
|
import {EOL} from 'os';
|
||||||
import {shell} from 'electron';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import * as shellEscape from 'php-escape-shell';
|
import * as shellEscape from 'php-escape-shell';
|
||||||
import last from '../utils/array';
|
import last from '../utils/array';
|
||||||
|
|
@ -212,12 +210,33 @@ export function moveTo(i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showPreferences() {
|
export function showPreferences() {
|
||||||
|
const isWin = process.platform === 'win32';
|
||||||
|
// eslint-disable-next-line no-template-curly-in-string
|
||||||
|
const command = isWin ? ' start notepad "%userprofile%\\.hyper.js"' : ' bash -c \'exec env ${EDITOR:=nano} ~/.hyper.js\'';
|
||||||
|
const message = [];
|
||||||
|
message.push(isWin ?
|
||||||
|
' echo Attempting to open ^%userprofile^%\\.hyper.js with notepad' :
|
||||||
|
' echo Attempting to open ~/.hyper.js with your \\$EDITOR');
|
||||||
|
message.push(' echo If it fails, open it manually with your favorite editor!');
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: UI_SHOW_PREFERENCES,
|
type: UI_SHOW_PREFERENCES,
|
||||||
effect() {
|
effect() {
|
||||||
dispatch(
|
dispatch(requestSession());
|
||||||
shell.showItemInFolder(path.join(os.homedir(), '.hyper.js')));
|
// Replace this hack with an async action
|
||||||
|
rpc.once('session add', ({uid}) => {
|
||||||
|
rpc.once('session data', () => {
|
||||||
|
dispatch(sendSessionData(
|
||||||
|
uid,
|
||||||
|
[
|
||||||
|
...message,
|
||||||
|
command,
|
||||||
|
''
|
||||||
|
].join(EOL)
|
||||||
|
));
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue