| 1234567891011121314151617181920212223242526272829303132 |
- import EditorEvents = require("../editor/EditorEvents");
- class ResourceOps extends Atomic.ScriptObject {
- }
- var resourceOps = new ResourceOps();
- export function CreateNewFolder(resourcePath: string, reportError: boolean = true): boolean {
- var title = "New Folder Error";
- var fs = Atomic.getFileSystem();
- if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
- if (reportError)
- resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
- return false;
- }
- if (!fs.createDir(resourcePath)) {
- if (reportError)
- resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Could not create " + resourcePath });
- return false;
- }
- return true;
- }
|