@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
43 lines (42 loc) • 1.91 kB
TypeScript
import { BrowserWindow, IpcMain, IpcMainInvokeEvent } from "electron";
import * as fs from "fs";
import CreatorTools from "../app/CreatorTools";
import LocalEnvironment from "../local/LocalEnvironment";
import ElectronUtils from "./ElectronUtils";
export default class FileSystemCommandHandler {
_window: BrowserWindow;
_ipcMain: IpcMain;
_env: LocalEnvironment;
_utils: ElectronUtils;
_watchingPaths: {
[name: string]: fs.FSWatcher;
};
/** Pending file changes for debouncing, keyed by storage path */
_pendingFileChanges: {
[storagePath: string]: {
added: Set<string>;
removed: Set<string>;
updated: Set<string>;
timer: NodeJS.Timeout | null;
};
};
constructor(browserWindow: BrowserWindow, incomingIpcMain: IpcMain, creatorTools: CreatorTools, env: LocalEnvironment, utils: ElectronUtils);
exists(evt: IpcMainInvokeEvent, data: string): void;
rootStorageExists(evt: IpcMainInvokeEvent, data: string): void;
/**
* Flushes pending file changes for a storage path, sending batched IPC messages.
* This is called after the debounce timer expires.
*/
_flushPendingChanges(storagePath: string): void;
folderExists(evt: IpcMainInvokeEvent, data: string): void;
getDirname(evt: IpcMainInvokeEvent, data: string): void;
renameFolder(evt: IpcMainInvokeEvent, data: string): void;
deleteFolder(evt: IpcMainInvokeEvent, data: string): void;
mkdir(evt: IpcMainInvokeEvent, data: string): void;
readDir(evt: IpcMainInvokeEvent, data: string): void;
writeFile(evt: IpcMainInvokeEvent, data: string): void;
readFile(evt: IpcMainInvokeEvent, data: string): void;
readUtf8File(evt: IpcMainInvokeEvent, data: string): void;
stat(evt: IpcMainInvokeEvent, data: string): void;
writeUtf8File(evt: IpcMainInvokeEvent, data: string): void;
}