mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-21 10:00:47 +01:00
Fixed open folder button on other platforms
This commit is contained in:
18
src/components/openFolder.ts
Normal file
18
src/components/openFolder.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {spawn} from 'child_process';
|
||||
import logger from './logger';
|
||||
|
||||
export default function openFolder(path:string) {
|
||||
if (process.platform === 'darwin') {
|
||||
spawn('open', [path]).on('error', (err) => {
|
||||
logger.errorMSG(err.message);
|
||||
});
|
||||
} else if (process.platform === 'win32') {
|
||||
spawn('explorer', [path]).on('error', (err) => {
|
||||
logger.errorMSG(err.message);
|
||||
});
|
||||
} else if (process.platform === 'linux') {
|
||||
spawn('xdg-open', [path]).on('error', (err) => {
|
||||
logger.errorMSG(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user