MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / init_cpp_project

Function init_cpp_project

crates/cli/src/subcommands/init.rs:1874–1900  ·  view source on GitHub ↗
(project_path: &Path)

Source from the content-addressed store, hash-verified

1872}
1873
1874pub fn init_cpp_project(project_path: &Path) -> anyhow::Result<()> {
1875 let export_files = vec![
1876 (
1877 include_str!("../../../../templates/basic-cpp/spacetimedb/CMakeLists.txt"),
1878 "CMakeLists.txt",
1879 ),
1880 (
1881 include_str!("../../../../templates/basic-cpp/spacetimedb/src/lib.cpp"),
1882 "src/lib.cpp",
1883 ),
1884 (
1885 include_str!("../../../../templates/basic-cpp/spacetimedb/.gitignore"),
1886 ".gitignore",
1887 ),
1888 ];
1889
1890 for data_file in export_files {
1891 let path = project_path.join(data_file.1);
1892 create_directory(path.parent().unwrap())?;
1893 std::fs::write(path, data_file.0)?;
1894 }
1895
1896 check_for_emscripten_and_cmake();
1897 check_for_git();
1898
1899 Ok(())
1900}
1901
1902pub async fn exec_init_rust(args: &ArgMatches) -> anyhow::Result<()> {
1903 let project_path = args.get_one::<PathBuf>("project-path").unwrap();

Callers 1

init_empty_cpp_serverFunction · 0.85

Calls 6

create_directoryFunction · 0.85
check_for_gitFunction · 0.85
joinMethod · 0.80
OkFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…