Overview
Zep provides a file system abstraction layer through theIZepFileSystem interface, allowing you to customize how the editor reads and writes files. This enables integration with virtual file systems, compressed archives, network storage, or any custom storage backend.
IZepFileSystem Interface
The core interface that defines Zep’s file system operations.Methods
File I/O
Read
Reads the entire contents of a file as a string.filePath- Path to the file to read
Write
Writes data to a file.filePath- Path to the file to writepData- Pointer to the data buffersize- Size of the data in bytes
true if the write was successful
Example:
Path Operations
GetConfigPath
Returns the application configuration directory where config files and the executable reside.GetSearchRoot
Finds the root directory for searches, optionally looking for a Git repository root.start- Starting path for the searchfoundGit- Output parameter set totrueif a Git root was found
GetWorkingDirectory
Gets the current working directory, typically the root of the project being edited.SetWorkingDirectory
Sets the current working directory.path- New working directory path
Directory Operations
MakeDirectories
Creates a directory and all necessary parent directories.path- Directory path to create
true if successful
IsDirectory
Checks if a path points to a directory.path- Path to check
true if the path is a directory
ScanDirectory
Recursively scans a directory, calling a callback for each file and subdirectory.path- Directory to scanfnScan- Callback function called for each entry- Returns
trueto continue scanning,falseto stop - Set
dont_recursetotrueto skip subdirectories
- Returns
File Properties
IsReadOnly
Checks if a file is read-only.path- File path to check
true if the file is read-only
Exists
Checks if a file or directory exists.path- Path to check
true if the path exists
Equivalent
Checks if two paths refer to the same file or directory.path1,path2- Paths to compare
true if the paths refer to the same file
Canonical
Returns the canonical (absolute, normalized) form of a path.path- Path to normalize
Configuration
SetFlags
Sets file system behavior flags.flags- Bitwise OR ofZepFileSystemFlagsvalues
ZepFileSystemCPP
The default file system implementation using C++ standard library (std::filesystem).
configPath- Path to the application configuration directory
ZepFileSystemFlags
Flags that control file system behavior.SearchGitRoot- When set,GetSearchRootwill look for a.gitdirectory
Implementing a Custom File System
To create a custom file system, inherit fromIZepFileSystem and implement all virtual methods:
