create path refactor, removed debug log

This commit is contained in:
mrfry
2023-05-01 10:56:26 +02:00
parent 4bb8059986
commit 1a3c806e66
19 changed files with 57 additions and 209 deletions
+14
View File
@@ -21,11 +21,17 @@ type FileDescriptor = {
description?: string
errorIfMissing?: boolean
warningIfMissing?: boolean
isDir?: boolean
}
export const validateAndSetupFiles = (): boolean => {
let everythingValid = true
Object.entries(files).forEach(([key, file]: [string, FileDescriptor]) => {
if (file.isDir) {
utils.CreatePath(file.path)
return
}
let fileExists = utils.FileExists(file.path)
if (file.defaultValue != null && !fileExists) {
// FIXME: create path too
@@ -313,6 +319,14 @@ export const files = {
keyFile: {
path: 'data/p2p/key',
},
// --------------------------------------------------------------------------------
// user files
// --------------------------------------------------------------------------------
userFilesDir: {
path: publicDir + 'userFiles',
isDir: true,
},
} as const satisfies Record<string, FileDescriptor>
export const paths = Object.entries(files).reduce(