Skip to content

Commit 666294b

Browse files
committed
app: plugin-management: Fix to only chmod a file if it is needed
This removes changing a file if it's not needed. Note: electron will also chmod a file if it's different from the default for user-plugins folders. I guess it must copy the files.
1 parent 15d6d85 commit 666294b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/electron/plugin-management.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,10 +1076,15 @@ export function getPluginBinDirectories(pluginsDir: string): string[] {
10761076
for (const file of files) {
10771077
const filePath = path.join(binDir, file);
10781078
// Skip directories
1079-
if (fs.statSync(filePath).isDirectory()) {
1079+
const stat = fs.statSync(filePath);
1080+
if (stat.isDirectory()) {
10801081
continue;
10811082
}
1082-
fs.chmodSync(filePath, 0o755); // rwx r-x r-x
1083+
const currentMode = stat.mode & 0o777;
1084+
if (currentMode !== 0o755) {
1085+
console.log(`Setting executable permissions for ${filePath}`);
1086+
fs.chmodSync(filePath, 0o755); // rwx r-x r-x
1087+
}
10831088
}
10841089
} catch (err) {
10851090
console.error(`Error setting executable permissions in ${binDir}:`, err);

0 commit comments

Comments
 (0)