Skip to content

Commit

Permalink
fix windows version cli
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryI committed Nov 3, 2024
1 parent ace1119 commit ed7aedf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Electron/build/cli_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set "exePath=%~2"
:: Create the batch file in System32 with the desired content
(
echo @echo off
echo call "%exePath%" %%*
echo call "%exePath%" %%~dpnx1
) > "%targetFile%"

echo File created at %targetFile% with content:
Expand Down
16 changes: 10 additions & 6 deletions Electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const { signal } = controller;

const { shell } = require('electron')

const { PARAMS, VALUE, MicaBrowserWindow, IS_WINDOWS_11, WIN10 } = require('mica-electron');
const { IS_WINDOWS_11, WIN10 } = require('mica-electron');

const isWindows = process.platform === 'win32'
const isMac = process.platform === 'darwin'
Expand Down Expand Up @@ -80,7 +80,7 @@ const cli_info = {

'win32': {
cliPath: '%SystemRoot%\\System32\\wljs.bat',
cliLink: '%SystemRoot%\\System32\\wljs.bat',
cliLink: isWindows ? path.join(process.env.windir, 'System32', 'wljs.bat') : '',
cmd: '',

script_uninstall: path.join(__dirname, 'build', 'cli_win_remove.bat'),
Expand Down Expand Up @@ -173,7 +173,6 @@ function check_cli_installed(log_window) {
} else {
fs.writeFile(path.join(installationFolder, '.nocli_i'), 'Nothing to see here', function(err) {
if (err) throw err;
cbk();
});
}
}, log_window);
Expand Down Expand Up @@ -2185,10 +2184,15 @@ function create_first_window() {
}
}

app.addRecentDocument(process.argv[pos]);
create_window({url: server.url.default() + '/' + encodeURIComponent(process.argv[pos]), title: process.argv[pos], show: false, focus: true, cacheClear: server.wasUpdated});
if (isFile(process.argv[pos])) {
app.addRecentDocument(process.argv[pos]);
create_window({url: server.url.default() + '/' + encodeURIComponent(process.argv[pos]), title: path.basename(process.argv[pos]), show: false, focus: true, cacheClear: server.wasUpdated});
} else {
create_window({url: server.url.default() + '/folder/' + encodeURIComponent(process.argv[pos]), title: path.basename(process.argv[pos]), show: false, focus: true, cacheClear: server.wasUpdated});
}

} else {
create_window({url: server.url.default(), title: 'Notebook', show: false, focus: false, cacheClear: server.wasUpdated});
create_window({url: server.url.default(), title: 'Default', show: false, focus: false, cacheClear: server.wasUpdated});
}

server.wasUpdated = false;
Expand Down
35 changes: 0 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed7aedf

Please sign in to comment.