Skip to content

createFileStructure does not pass file/folder intent to fsOperation.extend stat #1745

@Jobians

Description

@Jobians

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions