EditorFiles beta
Interface of @v12-engine/editor
export interface EditorFilesWhere a game's files are, for its editor (editor.files): the dev server's (the game's folder in the project), this browser's (no project), or a game's own (EditorOptions.files). Paths are from the game's folder, with / between; none leads out of it
Members
list
list(dir?: string): Promise<string[]>;The files in a folder and down, by their paths from the game's folder: none for a folder that is not there
read
read(path: string): Promise<string | undefined>;What a file holds, as text: none for one that is not there
remove
remove?(path: string, options?: {
force?: boolean;
}): Promise<void>;Takes a file away (nothing for one that is not there). Rejects with MapChanged when it changed since it was read, unless force. A store without it keeps every file it was given: the editor cannot delete one there
watch
watch?(path: string, listener: () => void): () => void;Told when a file changed other than through here (on disk, in another tab). Gives back what stops it
write
write(path: string, text: string, options?: {
force?: boolean;
}): Promise<void>;Writes a file (and the folders it is in). Rejects with MapChanged when it changed since it was read, unless force