Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.69 KB | None | 0 0
  1. private bool createProjectFiles(DirEntry* de)
  2.     {
  3.         if(de.isdir)
  4.         {
  5.             string rawBaseName = path.getBaseName(de.name);
  6.             string baseName = Project.adjustName(rawBaseName);
  7.             string folderPath = path.join(this._currentProjDir, baseName);
  8.             string templatePath = path.join(this._currentTemplDir, rawBaseName);
  9.  
  10.             mkdir(folderPath);
  11.  
  12.             string oldProjDir = this._currentProjDir;
  13.             string oldTempDir = this._currentTemplDir;
  14.             TreeNode oldNode = this._currentNode;
  15.            
  16.             this._currentProjDir = folderPath;
  17.             this._currentTemplDir = templatePath;
  18.             this._currentNode = this._currentNode.addNode(baseName, 1, 2);
  19.             listdir(this._currentTemplDir, &this.createProjectFiles);
  20.             this._currentNode = oldNode;
  21.             this._currentTemplDir = oldTempDir;
  22.             this._currentProjDir = oldProjDir;
  23.         }
  24.         else if(de.isfile && icmp(path.getExt(de.name), EXT_ICO))
  25.         {
  26.             string templateText = cast(string)std.file.read(de.name);
  27.             string mainFile = cmp(this._currentProjDir, this._completePath) ? Project.adjustName(path.getBaseName(de.name)) : Project.adjustName(format("%s.d", this._projectName));
  28.             string filePath = path.join(this._currentProjDir, mainFile);
  29.             std.file.write(filePath, templateText);
  30.  
  31.             TreeNode fileNode;
  32.  
  33.             switch(path.getExt(mainFile))
  34.             {
  35.                 case EXT_D:
  36.                     fileNode = this._currentNode.addNode(mainFile, 3);
  37.                     break;
  38.  
  39.                 case EXT_DI:
  40.                     fileNode = this._currentNode.addNode(mainFile, 6);
  41.                     break;
  42.  
  43.                 case EXT_RC:
  44.                     fileNode = this._currentNode.addNode(mainFile, 4);
  45.                     break;
  46.  
  47.                 default:
  48.                     fileNode = this._currentNode.addNode(mainFile);
  49.                     break;
  50.             }
  51.  
  52.             fileNode.tag = new ObjectContainer!(string)(filePath);
  53.         }
  54.        
  55.         return true;
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement