filefive
Version:
SFTP/FTP/Amazon S3 client and dual-panel file manager for macOS and Linux
43 lines (42 loc) • 1.88 kB
JavaScript
;
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 node_os_1 = require("node:os");
const node_path_1 = require("node:path");
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 settings = {
home: (0, node_os_1.homedir)(),
settings: (0, node_path_1.join)((0, node_os_1.homedir)(), '.f5', 'settings.json'),
connections: (0, node_path_1.join)((0, node_os_1.homedir)(), '.f5', 'connections'),
keybindings: keybindings_json_1.default,
mode: config?.mode ?? 'system',
theme: config?.theme ?? 'black',
fileTheme: config?.fileTheme ?? '',
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: (0, node_os_1.homedir)(), remote: (0, node_os_1.homedir)() },
sync: config?.sync ?? null
};
if (settings.fileTheme) {
settings.fileIcons = { languages: languages_json_1.default, ...(await loadFileIcons(settings.fileTheme)).default };
}
return settings;
}