WIP CCC Part Price Change.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { BrowserWindow, dialog, IpcMainInvokeEvent } from "electron";
|
||||
import { dialog, IpcMainInvokeEvent } from "electron";
|
||||
import log from "electron-log/main";
|
||||
import _ from "lodash";
|
||||
import Store from "../store/store";
|
||||
import { getMainWindow } from "../util/toRenderer";
|
||||
import {
|
||||
addWatcherPath,
|
||||
removeWatcherPath,
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
} from "../watcher/watcher";
|
||||
|
||||
const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
||||
const mainWindow = BrowserWindow.getAllWindows()[0]; //TODO: Filter to only main window once a proper key has been set.
|
||||
const mainWindow = getMainWindow();
|
||||
if (!mainWindow) {
|
||||
log.error("No main window found when trying to open dialog");
|
||||
return [];
|
||||
@@ -74,8 +75,30 @@ const SettingsWatcherPollingSet = async (
|
||||
|
||||
return { enabled, interval };
|
||||
};
|
||||
const SettingsPpcFilPathGet = async (): Promise<string> => {
|
||||
const ppcFilePath: string = Store.get("settings.ppcFilePath");
|
||||
return ppcFilePath;
|
||||
};
|
||||
const SettingsPpcFilPathSet = async (): Promise<string> => {
|
||||
const mainWindow = getMainWindow();
|
||||
if (!mainWindow) {
|
||||
log.error("No main window found when trying to open dialog");
|
||||
return "";
|
||||
}
|
||||
const result = await dialog.showOpenDialog(mainWindow, {
|
||||
properties: ["openDirectory"],
|
||||
});
|
||||
|
||||
if (!result.canceled) {
|
||||
Store.set("settings.ppcFilePath", result.filePaths[0]); //There should only ever be on directory that was selected.
|
||||
}
|
||||
|
||||
return (Store.get("settings.ppcFilePath") as string) || "";
|
||||
};
|
||||
|
||||
export {
|
||||
SettingsPpcFilPathGet,
|
||||
SettingsPpcFilPathSet,
|
||||
SettingsWatchedFilePathsAdd,
|
||||
SettingsWatchedFilePathsGet,
|
||||
SettingsWatchedFilePathsRemove,
|
||||
|
||||
Reference in New Issue
Block a user