2
0

PolycodeProjectManager.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "PolycodeProjectManager.h"
  2. PolycodeProjectManager::PolycodeProjectManager() {
  3. activeProject = NULL;
  4. }
  5. PolycodeProjectManager::~PolycodeProjectManager() {
  6. }
  7. PolycodeProject* PolycodeProjectManager::openProject(String path) {
  8. printf("Opening project %s\n", path.c_str());
  9. vector<String> bits = path.split("/.");
  10. String projectPath = "";
  11. for(int i=0; i < bits.size() - 2; i++) {
  12. projectPath += "/"+bits[i];
  13. }
  14. String projectName = bits[bits.size()-2];
  15. PolycodeProject* newProject = new PolycodeProject(projectName, projectPath, path);
  16. projects.push_back(newProject);
  17. projectBrowser->addProject(newProject);
  18. return newProject;
  19. }
  20. void PolycodeProjectManager::createNewProject(String templateFolder, String projectName, String projectLocation) {
  21. CoreServices::getInstance()->getCore()->createFolder(projectLocation);
  22. CoreServices::getInstance()->getCore()->copyDiskItem(templateFolder, projectLocation+"/"+projectName);
  23. CoreServices::getInstance()->getCore()->moveDiskItem(projectLocation+"/"+projectName+"/template.polyproject", projectLocation+"/"+projectName+"/"+projectName+".polyproject");
  24. openProject(projectLocation+"/"+projectName+"/"+projectName+".polyproject");
  25. }