mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Make the assets/themes folder if it doesn't exist
- Also only run clearThemes if the folder exists Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
2a38c4938d
commit
6514eb5209
1 changed files with 9 additions and 5 deletions
|
@ -17,11 +17,15 @@ const tempDirectory = fs.mkdtempSync(path.join(tmpdir(), "build-themes"));
|
|||
|
||||
// Clear existing themes
|
||||
function clearThemes(themeDirectory: string) {
|
||||
for (const file of fs.readdirSync(themeDirectory)) {
|
||||
if (file.endsWith(".json")) {
|
||||
const name = file.replace(/\.json$/, "");
|
||||
if (!colorSchemes.find((colorScheme) => colorScheme.name === name)) {
|
||||
fs.unlinkSync(path.join(themeDirectory, file));
|
||||
if (!fs.existsSync(themeDirectory)) {
|
||||
fs.mkdirSync(themeDirectory, { recursive: true });
|
||||
} else {
|
||||
for (const file of fs.readdirSync(themeDirectory)) {
|
||||
if (file.endsWith(".json")) {
|
||||
const name = file.replace(/\.json$/, "");
|
||||
if (!colorSchemes.find((colorScheme) => colorScheme.name === name)) {
|
||||
fs.unlinkSync(path.join(themeDirectory, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue