Skip to content

Commit

Permalink
Fix GitPortable path 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Nov 9, 2023
1 parent dd8035a commit f0cdc4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/main/src/GitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export const GitService = {
p.stdout.on('data', handleOutput);
p.stderr.on('data', handleOutput);

// This hits when the child process cannot be spawned
p.on('error', err => {
console.error(err.toString());
console.error("[Git spawn error]", err.toString());
resolve([false, err.toString()]);
});

// This hits whenever process can be spawned, can still fail or resolve.
p.on('exit', code => {
resolve([code===0 && !error,output]);
});
Expand Down
13 changes: 6 additions & 7 deletions packages/main/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ app.on('window-all-closed', () => {
app.on('activate', restoreOrCreateWindow);

const initCore = async () => {
if(process.platform === 'win32'){
const PATH = require('path');
const process_path_separator = ';';
// path to GitPortable executables.
process.env['PATH'] += process_path_separator + [process.resourcesPath,'bins','win', 'cmd'].join(PATH.sep);
}
ipcMain.handle('CORE.getVersion', ()=>process.env['npm_package_version']);
}

// fix portable path
if(process.platform === 'win32'){
const PATH = require('path');
const process_path_separator = ? ';' : ':';
process.env['PATH'] += process.env['PATH'] + process_path_separator + PATH.join([process.env['PORTABLE_EXECUTABLE_DIR'],'resources','bins']);
}

/**
* Create app window when background process will be ready
*/
Expand Down

0 comments on commit f0cdc4a

Please sign in to comment.