MCPcopy Create free account
hub / github.com/DFHack/dfhack / remove_old_install

Function remove_old_install

package/launchdf.cpp:285–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void remove_old_install(std::filesystem::path df_path)
286{
287 std::string message{
288 "Removing legacy files:"
289 };
290
291 for (auto file : old_filelist)
292 {
293 std::error_code ec;
294
295 std::filesystem::path p = df_path / file;
296
297 if (std::filesystem::is_directory(p))
298 std::filesystem::remove_all(p, ec);
299 else if (std::filesystem::is_regular_file(p))
300 std::filesystem::remove(p, ec);
301 else
302 continue;
303
304 message += "\n" + p.string() + ": " + (ec ? "failed to remove - " + ec.message() : "removed successfully");
305 }
306#ifdef WIN32
307 MessageBoxW(NULL, std::wstring(message.begin(), message.end()).c_str(), L"Legacy Install Cleanup", 0);
308#endif
309}
310
311#ifdef WIN32
312int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nShowCmd) {

Callers 1

mainFunction · 0.85

Calls 3

c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected