-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathConfig.ts
More file actions
28 lines (25 loc) · 1.07 KB
/
Config.ts
File metadata and controls
28 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { app } from 'electron'
import * as path from 'path';
import * as fs from 'fs';
export const rootConfigPath = path.join(app.getPath('appData'), 'Perspectivism')
export const dataPath = path.join(rootConfigPath, 'data')
export const languagesPath = path.join(rootConfigPath, 'languages')
export const holochainPath = path.join(rootConfigPath, 'holochain')
export const holochainConfigPath = path.join(holochainPath, 'config')
export const holochainDataPath = path.join(holochainPath, 'data')
export function init() {
const dirs = [rootConfigPath, dataPath, languagesPath, holochainPath, holochainConfigPath, holochainDataPath]
for(const d of dirs)
if(!fs.existsSync(d)) {
fs.mkdirSync(d)
}
}
export function getLanguageStoragePath(name) {
const languageConfigPath = path.join(languagesPath, name)
if(!fs.existsSync(languageConfigPath))
fs.mkdirSync(languageConfigPath)
const storageDirectory = path.join(languageConfigPath, "storage")
if(!fs.existsSync(storageDirectory))
fs.mkdirSync(storageDirectory)
return storageDirectory
}