MCPcopy Create free account
hub / github.com/coi/coi / get_template_dir

Function get_template_dir

src/cli/cli.cc:236–265  ·  view source on GitHub ↗

Get the template directory relative to the executable

Source from the content-addressed store, hash-verified

234
235// Get the template directory relative to the executable
236static fs::path get_template_dir(TemplateType template_type)
237{
238 fs::path exe_dir = get_executable_dir();
239 if (exe_dir.empty())
240 {
241 return fs::path();
242 }
243
244 // Determine which template to use
245 std::string template_name;
246 switch (template_type)
247 {
248 case TemplateType::Pkg:
249 template_name = "pkg";
250 break;
251 case TemplateType::App:
252 default:
253 template_name = "app";
254 break;
255 }
256
257 // The coi binary is at repo root, templates/ is a sibling
258 fs::path tpl_dir = exe_dir / "templates" / template_name;
259 if (fs::exists(tpl_dir))
260 {
261 return tpl_dir;
262 }
263
264 return fs::path();
265}
266
267// Replace __PLACEHOLDER__ patterns in a string
268static std::string replace_placeholders(const std::string &content,

Callers 1

init_projectFunction · 0.85

Calls 1

get_executable_dirFunction · 0.85

Tested by

no test coverage detected