From 6fe9545dd4255ecd9fdc22534c8fc70abd239c71 Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Fri, 23 May 2025 10:45:01 +0300 Subject: [PATCH 1/9] :wrench: Auto-create themes folder if not present --- src/main/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/app.ts b/src/main/app.ts index d74c60da4..b2ccbded6 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -89,6 +89,10 @@ export class KandoApp { /** This is called when the app is started. It initializes the backend and the window. */ public async init() { + await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { recursive: true }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { recursive: true }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { recursive: true }); + // Bail out if the backend is not available. if (this.backend === null) { throw new Error('No backend found.'); From ff9f568d34ed1986550114abe173e1b9e291c95d Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Fri, 23 May 2025 10:47:49 +0300 Subject: [PATCH 2/9] Update app.ts --- src/main/app.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index b2ccbded6..0c85bf728 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -89,9 +89,25 @@ export class KandoApp { /** This is called when the app is started. It initializes the backend and the window. */ public async init() { - await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { recursive: true }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { recursive: true }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { recursive: true }); + await fs.promises.mkdir( + path.join(app.getPath('userData'), 'menu-themes'), + { + recursive: true, + } + ); + await fs.promises.mkdir( + path.join(app.getPath('userData'), 'sound-themes'), + { + recursive: true, + } + ); + await fs.promises.mkdir( + path.join(app.getPath('userData'), 'icon-themes'), + { + recursive: true, + } + ); + // Bail out if the backend is not available. if (this.backend === null) { From 911d3d0d99f0f65d46847ee933a59920da083350 Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Fri, 23 May 2025 10:53:49 +0300 Subject: [PATCH 3/9] Update app.ts --- src/main/app.ts | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 0c85bf728..3bad1397c 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -89,25 +89,15 @@ export class KandoApp { /** This is called when the app is started. It initializes the backend and the window. */ public async init() { - await fs.promises.mkdir( - path.join(app.getPath('userData'), 'menu-themes'), - { - recursive: true, - } - ); - await fs.promises.mkdir( - path.join(app.getPath('userData'), 'sound-themes'), - { - recursive: true, - } - ); - await fs.promises.mkdir( - path.join(app.getPath('userData'), 'icon-themes'), - { - recursive: true, - } - ); - + await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { + recursive: true, + }); // Bail out if the backend is not available. if (this.backend === null) { From 82678b6a80fffb6efa8aae1eccc9371df925a0be Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Fri, 23 May 2025 10:56:06 +0300 Subject: [PATCH 4/9] Update app.ts --- src/main/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/app.ts b/src/main/app.ts index 3bad1397c..86b2e7b23 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -98,7 +98,7 @@ export class KandoApp { await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { recursive: true, }); - + // Bail out if the backend is not available. if (this.backend === null) { throw new Error('No backend found.'); From a4b1711ccd800f4c9f19e9cf520d0d8de0845c1d Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Sun, 25 May 2025 11:21:55 +0300 Subject: [PATCH 5/9] Update app.ts --- src/main/app.ts | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 86b2e7b23..09043b29a 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -89,16 +89,6 @@ export class KandoApp { /** This is called when the app is started. It initializes the backend and the window. */ public async init() { - await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { - recursive: true, - }); - // Bail out if the backend is not available. if (this.backend === null) { throw new Error('No backend found.'); @@ -122,6 +112,28 @@ export class KandoApp { }, }); + if (!this.generalSettings.get('ignoreWriteProtectedConfigFiles')) { + try { + await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { + recursive: true, + }); + } catch (error) { + if (error.code === 'EACCES' || error.code === 'EPERM') { + console.log("Failed to create the 'themes' folder due to write-protected files."); + } else { + console.error("An unexpected error occurred while creating theme folders:", error); + } + } + } else { + console.log("Skipping creation of theme folders due to ignoreWriteProtectedConfigFiles flag."); + } + // We load the settings from the user's home directory. If the settings file does // not exist, it will be created with the default values. this.menuSettings = new Settings({ From bb9f60695b1065efa799bcf3a047bb7210ede4ea Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Sun, 25 May 2025 11:27:10 +0300 Subject: [PATCH 6/9] Update app.ts --- src/main/app.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/app.ts b/src/main/app.ts index 09043b29a..0edd18e63 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -112,6 +112,35 @@ export class KandoApp { }, }); + if (!this.generalSettings.get('ignoreWriteProtectedConfigFiles')) { + try { + await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { + recursive: true, + }); + } catch (error) { + if (error.code === 'EACCES' || error.code === 'EPERM') { + console.log( + "Failed to create the 'themes' folder due to write-protected files." + ); + } else { + console.error( + 'An unexpected error occurred while creating theme folders:', + error + ); + } + } + } else { + console.log( + 'Skipping creation of theme folders due to ignoreWriteProtectedConfigFiles flag.' + ); + } + if (!this.generalSettings.get('ignoreWriteProtectedConfigFiles')) { try { await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { From ee459ba37c5a06658e1de4eda78f07ff97ff053b Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Sun, 25 May 2025 11:37:27 +0300 Subject: [PATCH 7/9] Update app.ts --- src/main/app.ts | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 0edd18e63..e9edf3b03 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -140,29 +140,7 @@ export class KandoApp { 'Skipping creation of theme folders due to ignoreWriteProtectedConfigFiles flag.' ); } - - if (!this.generalSettings.get('ignoreWriteProtectedConfigFiles')) { - try { - await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { - recursive: true, - }); - } catch (error) { - if (error.code === 'EACCES' || error.code === 'EPERM') { - console.log("Failed to create the 'themes' folder due to write-protected files."); - } else { - console.error("An unexpected error occurred while creating theme folders:", error); - } - } - } else { - console.log("Skipping creation of theme folders due to ignoreWriteProtectedConfigFiles flag."); - } - + // We load the settings from the user's home directory. If the settings file does // not exist, it will be created with the default values. this.menuSettings = new Settings({ From 9eb8ded1731fc580a68fb474fc45327a8be8cc17 Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Mon, 26 May 2025 08:54:02 +0300 Subject: [PATCH 8/9] Update app.ts --- src/main/app.ts | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 00b206f81..81c011076 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -112,33 +112,27 @@ export class KandoApp { }, }); - if (!this.generalSettings.get('ignoreWriteProtectedConfigFiles')) { - try { - await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { - recursive: true, - }); - await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { - recursive: true, - }); - } catch (error) { - if (error.code === 'EACCES' || error.code === 'EPERM') { - console.log( - "Failed to create the 'themes' folder due to write-protected files." - ); - } else { - console.error( - 'An unexpected error occurred while creating theme folders:', - error - ); - } + try { + await fs.promises.mkdir(path.join(app.getPath('userData'), 'menu-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'sound-themes'), { + recursive: true, + }); + await fs.promises.mkdir(path.join(app.getPath('userData'), 'icon-themes'), { + recursive: true, + }); + } catch (error) { + if (error.code === 'EACCES' || error.code === 'EPERM') { + console.log( + "Failed to create the 'themes' folder due to write-protected files." + ); + } else { + console.error( + 'An unexpected error occurred while creating theme folders:', + error + ); } - } else { - console.log( - 'Skipping creation of theme folders due to ignoreWriteProtectedConfigFiles flag.' - ); } // We load the settings from the user's home directory. If the settings file does From 7f174d6ca8bdf8a1649399f355a2e4b7bce5a2a2 Mon Sep 17 00:00:00 2001 From: yar2001Ti Date: Mon, 26 May 2025 08:57:30 +0300 Subject: [PATCH 9/9] Update app.ts --- src/main/app.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 81c011076..531c55008 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -124,9 +124,7 @@ export class KandoApp { }); } catch (error) { if (error.code === 'EACCES' || error.code === 'EPERM') { - console.log( - "Failed to create the 'themes' folder due to write-protected files." - ); + console.log("Failed to create the 'themes' folder due to write-protected files."); } else { console.error( 'An unexpected error occurred while creating theme folders:',