Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool createProjectFiles(DirEntry* de)
- {
- if(de.isdir)
- {
- string rawBaseName = path.getBaseName(de.name);
- string baseName = Project.adjustName(rawBaseName);
- string folderPath = path.join(this._currentProjDir, baseName);
- string templatePath = path.join(this._currentTemplDir, rawBaseName);
- mkdir(folderPath);
- string oldProjDir = this._currentProjDir;
- string oldTempDir = this._currentTemplDir;
- TreeNode oldNode = this._currentNode;
- this._currentProjDir = folderPath;
- this._currentTemplDir = templatePath;
- this._currentNode = this._currentNode.addNode(baseName, 1, 2);
- listdir(this._currentTemplDir, &this.createProjectFiles);
- this._currentNode = oldNode;
- this._currentTemplDir = oldTempDir;
- this._currentProjDir = oldProjDir;
- }
- else if(de.isfile && icmp(path.getExt(de.name), EXT_ICO))
- {
- string templateText = cast(string)std.file.read(de.name);
- string mainFile = cmp(this._currentProjDir, this._completePath) ? Project.adjustName(path.getBaseName(de.name)) : Project.adjustName(format("%s.d", this._projectName));
- string filePath = path.join(this._currentProjDir, mainFile);
- std.file.write(filePath, templateText);
- TreeNode fileNode;
- switch(path.getExt(mainFile))
- {
- case EXT_D:
- fileNode = this._currentNode.addNode(mainFile, 3);
- break;
- case EXT_DI:
- fileNode = this._currentNode.addNode(mainFile, 6);
- break;
- case EXT_RC:
- fileNode = this._currentNode.addNode(mainFile, 4);
- break;
- default:
- fileNode = this._currentNode.addNode(mainFile);
- break;
- }
- fileNode.tag = new ObjectContainer!(string)(filePath);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement