mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 13:32:42 +01:00
fix: settings window was unresponsive on first start because of fs.mkdir that wasn't awaited
This commit is contained in:
parent
8036cbb919
commit
a7dee5c2c9
@ -31,12 +31,13 @@ export const getOptions = (array: string[]) => {
|
|||||||
* @param directory to read from. Will be created if it doesn't exist
|
* @param directory to read from. Will be created if it doesn't exist
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const getThemeListFromDirectory = (directory: string) => {
|
export const getThemeListFromDirectory = (directory: string): string[] => {
|
||||||
try {
|
try {
|
||||||
makeUserThemesDirectory(directory);
|
makeUserThemesDirectory(directory);
|
||||||
return fs.readdirSync(directory).filter(cssFilter).sort(sort);
|
return fs.readdirSync(directory).filter(cssFilter).sort(sort);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,9 +47,7 @@ export const getThemeListFromDirectory = (directory: string) => {
|
|||||||
*/
|
*/
|
||||||
export const makeUserThemesDirectory = (directory: string) => {
|
export const makeUserThemesDirectory = (directory: string) => {
|
||||||
try {
|
try {
|
||||||
fs.mkdir(directory, { recursive: true }, (err) => {
|
fs.mkdirSync(directory, { recursive: true });
|
||||||
if (err) throw err;
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user