mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 11:53:49 +00:00
refactor: load project
This commit is contained in:
committed by
Carlos Valente
parent
9c5e403b18
commit
751c3329f0
@@ -1,5 +1,6 @@
|
||||
export const config = {
|
||||
appState: 'app-state.json',
|
||||
corrupt: 'corrupt files',
|
||||
crash: 'crash logs',
|
||||
database: {
|
||||
testdb: 'test-db',
|
||||
|
||||
@@ -56,10 +56,10 @@ const currentDir = dirname(__dirname);
|
||||
// locally we are in src/setup, in the production build, this is a single file at src
|
||||
export const srcDirectory = isProduction ? currentDir : join(currentDir, '../');
|
||||
|
||||
// resolve path to external
|
||||
// TODO: simplify logic
|
||||
// resolve path to client
|
||||
const productionPath = join(srcDirectory, 'client/');
|
||||
const devPath = join(srcDirectory, '../../client/build/');
|
||||
|
||||
export const resolvedPath = (): string => {
|
||||
if (isTest) {
|
||||
return devPath;
|
||||
@@ -136,7 +136,10 @@ export const resolveRestoreFile = join(getAppDataPath(), config.restoreFile);
|
||||
export const resolveSheetsDirectory = join(getAppDataPath(), config.sheets.directory);
|
||||
|
||||
// path to crash reports
|
||||
export const resolveCrashReportDirectory = getAppDataPath();
|
||||
export const resolveCrashReportDirectory = join(getAppDataPath(), config.crash);
|
||||
|
||||
// path to projects
|
||||
export const resolveProjectsDirectory = join(getAppDataPath(), config.projects);
|
||||
|
||||
// path to corrupt files
|
||||
export const resolveCorruptDirectory = join(getAppDataPath(), config.corrupt);
|
||||
|
||||
@@ -56,7 +56,7 @@ async function loadDb(directory: string, filename: string) {
|
||||
let newData: DatabaseModel = dbModel;
|
||||
|
||||
try {
|
||||
const maybeProjectFile = parseProjectFile(dbInDisk);
|
||||
const maybeProjectFile = await parseProjectFile(dbInDisk);
|
||||
const result = parseJson(maybeProjectFile);
|
||||
|
||||
await appStateProvider.setLastLoadedProject(filename);
|
||||
|
||||
Reference in New Issue
Block a user