Repository navigation
Fix #459: failed to make New File and New Folder and show Error messa... - #469
Merged
purocean merged 1 commit intoApr 16, 2026
Conversation
|
@JiwaniZakir is attempting to deploy a commit to the purocean's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
The fix looks correct — checking the original |
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.
Closes #459
Motivation
On Windows,
path.join()called insidewithRepostrips the trailing slash from directory paths before the trailing-separator check runs. This caused both "New File" and "New Folder" operations to fall through to the file-write branch, producingENOENT: no such file or directory(for files) or silently doing nothing (for folders) because the target directory path was treated as a file path.Changes
src/main/server/file.ts—writefunction (~line 229)The condition guarding
fs.ensureDirpreviously only checkedfilePath.endsWith(path.sep), wherefilePathis derived frompath.join()and therefore never has a trailing separator. The fix adds a check on the originalpparameter (beforewithReponormalizes it) for a trailing/:The
p.endsWith('/')check preserves the intent of the caller's signal (a trailing slash means "this is a directory") regardless of howpath.joinnormalizes the path on any OS.Testing
p.endsWith('/')fires for directory paths on these platforms as well, making the fix consistent cross-platform.falseand execution continues to the file-write logic.This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.