Fix project creation on read-only filesystems (NixOS)#854
Open
taciturnaxolotl wants to merge 1 commit intowpilibsuite:mainfrom
Open
Fix project creation on read-only filesystems (NixOS)#854taciturnaxolotl wants to merge 1 commit intowpilibsuite:mainfrom
taciturnaxolotl wants to merge 1 commit intowpilibsuite:mainfrom
Conversation
When the vscode-wpilib extension is installed on a read-only filesystem (e.g. the Nix store on NixOS), ncp preserves the source's read-only file permissions when copying template files to create a new project. This causes project creation to fail because subsequent steps cannot write to the copied files (e.g. replacing placeholders in build.gradle). Add a setWritableRecursive helper that ensures all copied files have the owner-write permission bit set, and call it after each ncp copy in ncpAsync. Fixes project creation on NixOS / systems using Nix package manager.
524ece9 to
085add5
Compare
Author
|
fixed formatting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the
vscode-wpilibextension is installed via a read-only filesystem (e.g. the Nix store on NixOS), project creation fails with "Cannot create into non empty folder" becausencppreserves source file permissions when copying templates but files in the Nix store are read-only (0444). The copied project files inherit read-only permissions and then subsequent steps (e.g. replacing###GRADLERIOREPLACE###inbuild.gradle) fail becausefs.writeFilecannot write to read-only files.Changes
permissions.ts: AddsetWritableRecursive()helper that recursively ensures owner-write permission on all files/directories (no-op on Windows)utilities.ts: CallsetWritableRecursive(dest)after eachncpcopy inncpAsyncto ensure copied files are always writableThis is a no-op on normal systems where files are already writable, and fixes project creation on NixOS and any other environment where the extension is installed on a read-only filesystem.