MCPcopy Create free account
hub / github.com/acl-dev/acl / copy_and_replace

Method copy_and_replace

app/wizard/file_tmpl.cpp:39–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39bool file_tmpl::copy_and_replace(const char* from,
40 const char* to, bool exec /* = false */)
41{
42 tpl_t* tpl = open_tpl(from);
43 if (tpl == NULL) {
44 return false;
45 }
46
47 tpl_set_field_fmt_global(tpl, "PROGRAM", "%s", project_name_.c_str());
48
49 string filepath;
50 filepath << path_to_ << '/' << to;
51 if (tpl_save_as(tpl, filepath.c_str()) != TPL_OK) {
52 printf("save to %s error: %s\r\n", filepath.c_str(),
53 last_serror());
54 tpl_free(tpl);
55 return false;
56 }
57 printf("create %s ok.\r\n", filepath.c_str());
58 tpl_free(tpl);
59
60 if (exec) {
61#ifndef WIN32
62 chmod(filepath.c_str(), S_IRUSR | S_IWUSR | S_IXUSR |
63 S_IRGRP | S_IWGRP | S_IXGRP);
64#endif
65 }
66 return true;
67}
68
69void file_tmpl::create_dirs()
70{

Callers 10

create_threadsFunction · 0.80
create_fiberFunction · 0.80
create_procFunction · 0.80
create_master_threadsFunction · 0.80
create_master_fiberFunction · 0.80
create_master_procFunction · 0.80
create_master_aioFunction · 0.80
create_master_rpcFunction · 0.80
create_master_triggerFunction · 0.80
create_master_udpFunction · 0.80

Calls 5

tpl_set_field_fmt_globalFunction · 0.70
tpl_save_asFunction · 0.70
tpl_freeFunction · 0.70
last_serrorFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected