Skip to content

Commit 2dc54c1

Browse files
Merge pull request #161 from Accedia/changed-directory-for-fit-bat
Changed directory for fit bat
2 parents a89f65f + 7773f96 commit 2dc54c1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

electron-app/src/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import log from 'electron-log';
1414
import { FirebaseService, SessionStatus } from './utils/firebase';
1515
import mitchell_importer from './utils/mitchell_importer';
1616
import { spawn } from 'child_process';
17+
import * as os from 'os';
18+
19+
const userHomeDir = os.homedir();
20+
const fitMitchellCloudPath = path.join(userHomeDir, 'AppData', 'Local', 'FIT-Mitchell_Cloud', 'FIT.bat');
1721

1822
const INPUT_SPEED_STORAGE_KEY = 'inputSpeed';
1923

@@ -62,7 +66,10 @@ class Main {
6266
const url = getCustomProtocolUrl(argv);
6367
if (argv.some((url) => url.includes('openVBS'))) {
6468
try {
65-
const bat = spawn('C:\\FIT-Mitchell-Cloud-RO-Import-Tool\\FIT.bat', [], { windowsHide: true });
69+
log.info(fitMitchellCloudPath);
70+
const bat = spawn(fitMitchellCloudPath, [], { windowsHide: true });
71+
log.info('here');
72+
6673
bat.on('close', (code) => {
6774
log.info(`Child process exited with code ${code}`);
6875
app.quit();

electron-app/src/utils/window_manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { extractSessionIdFromUrl } from './extract_sessionid_from_url';
1212
import mitchell_importer from './mitchell_importer';
1313
import log from 'electron-log';
1414
import { spawn } from 'child_process';
15+
import * as os from 'os';
16+
17+
const userHomeDir = os.homedir();
18+
const fitMitchellCloudPath = path.join(userHomeDir, 'AppData', 'Local', 'FIT-Mitchell_Cloud', 'FIT.bat');
1519

1620
type MaybeBrowserWindow = BrowserWindow | null;
1721

@@ -76,7 +80,7 @@ class WindowManager {
7680
console.log('VBS URL', process.argv);
7781
if (shouldOpenVBS) {
7882
try {
79-
const bat = spawn('C:\\FIT-Mitchell-Cloud-RO-Import-Tool\\FIT.bat', [], { windowsHide: true });
83+
const bat = spawn(fitMitchellCloudPath, [], { windowsHide: true });
8084
bat.on('close', (code) => {
8185
console.log(`Child process exited with code ${code}`);
8286
app.quit();

0 commit comments

Comments
 (0)