MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / PIDFile

Method PIDFile

radiant/log/PIDFile.h:23–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22public:
23 PIDFile(const std::string& filename)
24 {
25 IModuleRegistry& registry = module::GlobalModuleRegistry();
26 _filename = registry.getApplicationContext().getSettingsPath() + filename;
27
28 FILE* pid = fopen(_filename.c_str(), "r");
29
30 // Check for an existing radiant.pid file
31 if (pid != nullptr)
32 {
33 fclose(pid);
34
35 removePIDFile();
36
37#ifndef _DEBUG
38 fs::path path = registry.getApplicationContext().getSettingsPath();
39 path /= "darkradiant.log";
40 std::string logPath = path.string();
41 string::replace_all(logPath, "\\\\", "\\");
42 string::replace_all(logPath, "//", "/");
43
44 std::string msg("Radiant failed to start properly the last time it was run.\n");
45 msg += "If this is happening again, you might want to check the log file in\n";
46 msg += logPath;
47
48 wxutil::Messagebox box("DarkRadiant - Startup Failure", msg, ui::IDialog::MESSAGE_CONFIRM);
49 box.run();
50#endif
51 }
52
53 // create a primary .pid for global init run
54 pid = fopen(_filename.c_str(), "w");
55
56 if (pid)
57 {
58 fclose(pid);
59 }
60 };
61
62 ~PIDFile()
63 {

Callers

nothing calls this directly

Calls 5

replace_allFunction · 0.85
stringMethod · 0.80
getSettingsPathMethod · 0.45
c_strMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected