File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,9 @@ void generate_project(const std::string &type) {
209209 throw std::runtime_error (" Cannot initialize a project when cmake.toml already exists!" );
210210 }
211211
212+ // Check if the folder is empty before creating any files
213+ auto is_empty = fs::is_empty (fs::current_path ());
214+
212215 // Automatically generate .gitattributes to not skew the statistics of the repo
213216 generate_gitfile (" .gitattributes" , {" /**/CMakeLists.txt linguist-generated" , " /**/cmkr.cmake linguist-vendored" });
214217
@@ -220,7 +223,7 @@ void generate_project(const std::string &type) {
220223 {" @type" , type},
221224 };
222225
223- if (!fs:: is_empty( fs::current_path ()) ) {
226+ if (!is_empty) {
224227 // Make a backup of an existing CMakeLists.txt if it exists
225228 std::error_code ec;
226229 fs::rename (" CMakeLists.txt" , " CMakeLists.txt.bak" , ec);
You can’t perform that action at this time.
0 commit comments