ensure user.scss exists

This commit is contained in:
Jiiks 2019-02-28 15:10:34 +02:00
parent f051bc4812
commit d75b907ae4
2 changed files with 17 additions and 0 deletions

View File

@ -46,6 +46,9 @@ export default class Editor extends Module {
}));
const userscssPath = path.resolve(this.bd.config.getPath('data'), 'user.scss');
await FileUtils.ensureFile(userscssPath);
const userscss = await FileUtils.readFile(userscssPath);
constructFiles.push({
caption: 'userstyle',

View File

@ -85,6 +85,20 @@ export class FileUtils {
});
}
static async ensureFile(path) {
try {
await this.fileExists(path);
return true;
} catch (err) {
try {
await this.writeFile(path, '');
return true;
} catch (err) {
throw err;
}
}
}
static async readJsonFromFile(path) {
let readFile;
try {