Files
blockflow-workbench/src/project/fileSystem.ts
gamewhale 589ff15213 chore: 初始化 BlockFlow Workbench 仓库
建立前端与 Tauri 桌面端的首个版本提交,包含核心编辑器、项目文件读写、测试与构建配置。

补充 Git 忽略规则和换行规范,排除依赖、构建产物、本地运行日志与临时验证文件,方便在其他电脑继续开发。
2026-05-29 17:23:43 +08:00

23 lines
649 B
TypeScript

export type DirectoryEntry = {
name: string
path: string
type: "file" | "directory"
}
export type ProjectFileSystem = {
readText(filePath: string): Promise<string>
writeText(filePath: string, content: string): Promise<void>
mkdir(dirPath: string): Promise<void>
readdir(dirPath: string): Promise<DirectoryEntry[]>
exists(filePath: string): Promise<boolean>
stat(filePath: string): Promise<{ type: "file" | "directory" }>
}
export function requireProjectFileSystem(fs: ProjectFileSystem | undefined): ProjectFileSystem {
if (fs === undefined) {
throw new Error("A ProjectFileSystem adapter is required.")
}
return fs
}