packager icon indicating copy to clipboard operation
packager copied to clipboard

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

Open ma-sattari opened this issue 2 years ago • 1 comments

Preflight Checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project follows, as appropriate.
  • [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

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

ma-sattari avatar Jun 23 '23 15:06 ma-sattari

👋 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.

welcome[bot] avatar Jun 23 '23 15:06 welcome[bot]

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.

yangannyx avatar Feb 08 '24 23:02 yangannyx