MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / open_projects

Function open_projects

modules/tools/resource_compiler/main.cpp:85–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85skr::Vector<skd::SProject*> open_projects(int argc, char** argv)
86{
87 skr::cmd::parser parser(argc, argv);
88 parser.add(u8"project", u8"project path", u8"-p", false);
89 parser.add(u8"workspace", u8"workspace path", u8"-w", true);
90 if(!parser.parse())
91 {
92 SKR_LOG_ERROR(u8"Failed to parse command line arguments.");
93 return {};
94 }
95 auto projectPath = parser.get_optional<skr::String>(u8"project");
96
97 std::error_code ec = {};
98 skr::filesystem::path workspace{parser.get<skr::String>(u8"workspace").u8_str()};
99 skd::SProject::SetWorkspace(workspace);
100 skr::filesystem::recursive_directory_iterator iter(workspace, ec);
101 skr::stl_vector<skr::filesystem::path> projectFiles;
102 while (iter != end(iter))
103 {
104 if(iter->is_regular_file(ec) && iter->path().extension() == ".sproject")
105 {
106 projectFiles.push_back(iter->path());
107 }
108 iter.increment(ec);
109 }
110
111 skr::Vector<skd::SProject*> result;
112 for (auto& projectFile : projectFiles)
113 {
114 if(auto proj = skd::SProject::OpenProject(projectFile))
115 result.add(proj);
116 }
117 return result;
118}
119
120int compile_project(skd::SProject* project)
121{

Callers 1

compile_allFunction · 0.85

Calls 7

endFunction · 0.50
addMethod · 0.45
parseMethod · 0.45
u8_strMethod · 0.45
pathMethod · 0.45
push_backMethod · 0.45
incrementMethod · 0.45

Tested by

no test coverage detected