electron / packager

Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI
https://npm.im/@electron/packager
BSD 2-Clause "Simplified" License
146 stars 16 forks source link

Preserve file attributes while copying with 'extra-resource' option #1523

Closed ma-sattari closed 4 months ago

ma-sattari commented 1 year ago

Preflight Checklist

Problem Description

According to file usage.txt when using extra-resource option in build time you use fs-extra package to copy extra resources to target folder. However, the attributes of file is cleared after copy operation is done. We have an executable C file with (rwx rwx r--) bits set. When file is copied to target directory executable attribute of file is removed and we are not able to execute it within electron.

Proposed Solution

According to this file from Copy Usage fs-extra package you may pass a preserveTimestamps <boolean> option when calling copy function like this: copy(src, dest[, options][, callback]). According to this code snippet copy.js when using this option we may preserve mode in addition to Timestamps. Updating this code in your repo platform.js and adding the preserveTimestamps option will add the capability to preserve both Timestamps and mode in the target directory.

Alternatives Considered

Additional Information

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

yangannyx commented 7 months ago

Are you still running into this issue @ma-sattari? Looking at this line in fs-extra's copy.js, it seems like the destination file is always set to the same mode as the source file.