|
async createFileStructure(uri, pathString, isFile = true) { |
Problem:
helpers.createFileStructure() passes isFile only at the top-level call. Inside its loop, it calls:
if (!(await fsOperation(newPath).exists())) { ... }
exists() is called on newPath
createFile() / createDirectory() is called on the parent path (currentUri)
stat() inside fsOperation.extend() cannot know whether the path is intended to be a file or folder.
Impact:
- Files inside folders are treated as directories.
- Creating folders in the root may fail.
- Virtual paths cannot be correctly typed (
isFile / isDirectory) before creation.
Root cause:
isFile is never passed to fsOperation(newPath).exists() or stat().
Proposed solution:
- Expose the
isFile intent to fsOperation.extend() / stat() calls inside the loop.
- Or provide a context/hook so FS extensions can detect the user’s intent.
Notes:
- Affects virtual file systems (paths not tied to a real filesystem).
- Current workarounds require storing
isFile externally, which is complex.
Acode/src/utils/helpers.js
Line 383 in d5b2ec9
Problem:
helpers.createFileStructure()passesisFileonly at the top-level call. Inside its loop, it calls:exists()is called onnewPathcreateFile()/createDirectory()is called on the parent path (currentUri)stat()insidefsOperation.extend()cannot know whether the path is intended to be a file or folder.Impact:
isFile/isDirectory) before creation.Root cause:
isFileis never passed tofsOperation(newPath).exists()orstat().Proposed solution:
isFileintent tofsOperation.extend()/stat()calls inside the loop.Notes:
isFileexternally, which is complex.