Project files tweaks (#679)

* chore: fixed issue when loading first time; deleting excel file after upload; only json files from project list

* chore: added last loaded project to endpoint response

* chore: incremental file name

---------

Co-authored-by: Name <Email>
This commit is contained in:
Ary
2023-12-30 11:32:17 -07:00
committed by GitHub
parent c5c0401ac4
commit 7b9f64a630
9 changed files with 613 additions and 30 deletions
+4 -2
View File
@@ -3,6 +3,7 @@ import path, { dirname, join } from 'path';
import fs from 'fs';
import { config } from './config/config.js';
import { ensureDirectory } from './utils/fileManagement.js';
// =================================================
// resolve public path
@@ -71,7 +72,7 @@ export const currentDirectory = dirname(__dirname);
const testDbStartDirectory = isTest ? '../' : getAppDataPath();
export const externalsStartDirectory = isProduction ? getAppDataPath() : join(currentDirectory, 'external');
const lastLoadedProjectConfigPath = join(getAppDataPath(), 'config.json');
export const lastLoadedProjectConfigPath = join(getAppDataPath(), 'config.json');
let lastLoadedProject;
@@ -79,7 +80,8 @@ try {
lastLoadedProject = JSON.parse(fs.readFileSync(lastLoadedProjectConfigPath, 'utf8')).lastLoadedProject;
} catch {
if (!isTest) {
fs.writeFileSync(lastLoadedProjectConfigPath, JSON.stringify({ lastLoadedProject: null }));
ensureDirectory(getAppDataPath());
fs.writeFileSync(lastLoadedProjectConfigPath, JSON.stringify({ lastLoadedProject: 'default.json' }));
}
}