Skip to main content

Module WriteOperations

Module WriteOperations 

Source
Expand description

§FileSystemProvider - Write Operations

Implements FileSystemWriter for MountainEnvironment. Every function calls Utility::PathSecurity::IsPathAllowedForAccess before any I/O.

§Functions

  • write_file_impl - writes bytes to a path. Enforces a 1 GB content guard, create / overwrite flag semantics (mirroring vscode.workspace.fs.writeFile), and auto-creates missing parent directories. Note: currently writes directly; the inline comment documents the planned atomic-rename pattern (write-to-temp → fsync → rename).
  • create_directory_impl - creates a directory, optionally recursively. Validates that the parent is not a regular file.
  • delete_impl - removes a file or directory. recursive controls remove_dir_all vs remove_dir. _use_trash is stubbed; the trash crate integration is planned. Idempotent: NotFound is treated as success.
  • rename_impl - calls tokio::fs::rename (POSIX-atomic within a filesystem). Both source and target are path-security checked.
  • copy_impl - copies a file or directory tree. Directories use the private copy_directory_recursive helper, which walks an explicit stack to avoid deep async-recursion stack overflows.
  • create_file_impl - thin wrapper over write_file_impl with empty content, create=true, overwrite=false.

Functions§

copy_directory_recursive 🔒
Recursively copy a directory tree from source into target. Iterative (uses an explicit stack of (SrcDir, DstDir)) so it can’t blow the Tokio task stack on very deep trees. Files inside re-use tokio::fs::copy for fast path; directories are created with create_dir. Symlinks are dereferenced.
copy_impl 🔒
Copy operations implementation for MountainEnvironment
create_directory_impl 🔒
CreateDirectory operations implementation for MountainEnvironment
create_file_impl 🔒
CreateFile operations implementation for MountainEnvironment
delete_impl 🔒
Delete operations implementation for MountainEnvironment
rename_impl 🔒
Rename operations implementation for MountainEnvironment
write_file_impl 🔒
Write operations implementation for MountainEnvironment