Fix macos builds

This commit is contained in:
Nayam Amarshe
2023-11-10 17:11:35 +05:30
parent 076a7191d4
commit e610e7b8a9
13 changed files with 288 additions and 205 deletions

View File

@@ -1,11 +1,29 @@
import fs from "fs";
import logit from "./logit";
import { MessageBoxOptions, dialog } from "electron";
import { MessageBoxOptions, app, dialog } from "electron";
import settings from "electron-settings";
const getModels = (folderPath: string | undefined) => {
const getModels = async (folderPath: string | undefined) => {
let models: string[] = [];
let isValid = false;
// SECURITY SCOPED BOOKMARKS
let closeAccess;
const customModelsBookmarks = await settings.get("custom-models-bookmarks");
if (customModelsBookmarks) {
console.log(
"🚀 => file: get-models.ts:18 => customModelsBookmarks:",
customModelsBookmarks
);
try {
closeAccess = app.startAccessingSecurityScopedResource(
customModelsBookmarks as string
);
} catch (error) {
logit("📁 Custom Models Bookmarks Error: ", error);
}
}
if (!folderPath) {
logit("❌ Invalid Custom Model Folder Detected");
const options: MessageBoxOptions = {

View File

@@ -11,8 +11,8 @@ import { getMainWindow } from "../main-window";
* // Set a value
* settings.set("key", value);
*/
export const settings = {
get: (key: string, parse: boolean = false): any => {
export const localStorage = {
get: <T>(key: string, parse: boolean = false): T | null => {
const mainWindow = getMainWindow();
if (!mainWindow) return null;
let result = null;