ensure user.scss exists
This commit is contained in:
parent
f051bc4812
commit
d75b907ae4
|
@ -46,6 +46,9 @@ export default class Editor extends Module {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const userscssPath = path.resolve(this.bd.config.getPath('data'), 'user.scss');
|
const userscssPath = path.resolve(this.bd.config.getPath('data'), 'user.scss');
|
||||||
|
|
||||||
|
await FileUtils.ensureFile(userscssPath);
|
||||||
|
|
||||||
const userscss = await FileUtils.readFile(userscssPath);
|
const userscss = await FileUtils.readFile(userscssPath);
|
||||||
constructFiles.push({
|
constructFiles.push({
|
||||||
caption: 'userstyle',
|
caption: 'userstyle',
|
||||||
|
|
|
@ -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) {
|
static async readJsonFromFile(path) {
|
||||||
let readFile;
|
let readFile;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue