UNPKG

filefive

Version:

SFTP/FTP/Amazon S3 client and dual-panel file manager for macOS and Linux

44 lines (43 loc) 1.85 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const posix_1 = require("node:path/posix"); const Local_1 = require("../Local"); const Local_2 = require("../fs/Local"); const connect_1 = require("./connect"); const keybindings_json_1 = __importDefault(require("../keybindings.json")); const languages_json_1 = __importDefault(require("../icon-themes/languages.json")); function loadFileIcons(theme) { return import(`../icon-themes/${theme}.json`, { with: { type: "json" } }); } async function default_1(path) { let config = null; try { config = JSON.parse(await (0, Local_1.read)(path)); } catch (e) { } const home = (0, Local_1.pwd)(); const settings = { isWin: (0, Local_1.isWin)(), home, settings: (0, posix_1.join)(home, '.f5', 'settings.json'), connections: (0, posix_1.join)(home, '.f5', 'connections'), keybindings: keybindings_json_1.default, mode: config?.mode ?? 'system', theme: config?.theme ?? 'black', fileTheme: typeof config?.fileTheme === 'string' ? config.fileTheme : 'material', timeFmt: config?.timeFmt ?? 'yyyy-MM-dd HH:mm', sizeFmt: config?.sizeFmt ?? '0.0 b', local: (0, connect_1.explorerSettings)(Local_2.ATTRIBUTES, config?.local), remote: (0, connect_1.explorerSettings)(Local_2.ATTRIBUTES, config?.remote), path: config?.path ?? { local: home, remote: home }, sync: config?.sync ?? null }; if (settings.fileTheme) { settings.fileIcons = { languages: languages_json_1.default, ...(await loadFileIcons(settings.fileTheme)).default }; } return settings; }