Project.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include <Atomic/Core/Object.h>
  2. #include <Atomic/IO/FileSystem.h>
  3. using namespace Atomic;
  4. #include "../Platform/Platform.h"
  5. namespace ToolCore
  6. {
  7. class ProjectUserPrefs;
  8. class ProjectBuildSettings;
  9. class Project : public Object
  10. {
  11. friend class ProjectFile;
  12. OBJECT(Project);
  13. public:
  14. /// Construct.
  15. Project(Context* context);
  16. /// Destruct.
  17. virtual ~Project();
  18. bool Load(const String& fullpath);
  19. void Save(const String& fullpath = "");
  20. /// Paths
  21. const String GetResourcePath() { return resourcePath_; }
  22. void SetResourcePath(const String& resourcePath)
  23. {
  24. resourcePath_ = AddTrailingSlash(resourcePath);
  25. componentsPath_ = resourcePath_ + "Components";
  26. scriptsPath_ = resourcePath_ + "Scripts";
  27. modulesPath_ = resourcePath_ + "Modules";
  28. }
  29. const String& GetComponentsPath() { return componentsPath_; }
  30. const String& GetScriptsPath() { return scriptsPath_; }
  31. const String& GetModulesPath() { return modulesPath_; }
  32. const String& GetProjectFilePath() { return projectFilePath_; }
  33. bool IsComponentsDirOrFile(const String& fullPath);
  34. bool IsScriptsDirOrFile(const String& fullPath);
  35. bool IsModulesDirOrFile(const String& fullPath);
  36. void SaveBuildSettings(const String& path);
  37. bool LoadBuildSettings(const String& path);
  38. void AddPlatform(PlatformID platformID);
  39. bool ContainsPlatform(PlatformID platformID);
  40. void RemovePlatform(PlatformID platformID);
  41. bool IsDirty() { return dirty_; }
  42. ProjectBuildSettings* GetBuildSettings();
  43. String GetUserPrefsFullPath();
  44. String GetBuildSettingsFullPath();
  45. private:
  46. void LoadUserPrefs(const String& fullpath);
  47. void SaveUserPrefs(const String& fullpath);
  48. String projectFilePath_;
  49. String resourcePath_;
  50. String componentsPath_;
  51. String scriptsPath_;
  52. String modulesPath_;
  53. bool dirty_;
  54. SharedPtr<ProjectUserPrefs> userPrefs_;
  55. SharedPtr<ProjectBuildSettings> buildSettings_;
  56. List<PlatformID> platforms_;
  57. };
  58. }