MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / run

Method run

src/openms/source/SYSTEM/UpdateCheck.cpp:35–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33namespace OpenMS
34{
35 void UpdateCheck::run(const String& tool_name, const String& version, int debug_level)
36 {
37 String architecture = QSysInfo::WordSize == 32 ? "32" : "64";
38
39 // if the revision info is meaningful, show it as well
40 String revision("UNKNOWN");
41 if (!VersionInfo::getRevision().empty() && VersionInfo::getRevision() != "exported")
42 {
43 revision = VersionInfo::getRevision();
44 }
45 String platform;
46
47#ifdef OPENMS_WINDOWSPLATFORM
48 platform = "Win";
49#elif __APPLE__
50 platform = "Mac";
51#elif __linux__
52 platform = "Linux";
53#elif __unix__
54 platform = "Unix";
55#else
56 platform = "unknown";
57#endif
58
59 // write to tmp + userid folder
60
61 // e.g.: OpenMS_Default_Win_64_FeatureFinderCentroided_2.0.0
62 String tool_version_string;
63 String config_path;
64 //Comply with https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html on unix identifying systems
65 #ifdef __unix__
66 if (getenv("XDG_CONFIG_HOME"))
67 {
68 config_path = String(getenv("XDG_CONFIG_HOME")) + "/OpenMS";
69 }
70 else
71 {
72 config_path = File::getOpenMSHomePath() + "/.config/OpenMS";
73 }
74 #else
75 config_path = File::getOpenMSHomePath() + "/.OpenMS";
76 #endif
77 tool_version_string = String("OpenMS") + "_" + "Default_" + platform + "_" + architecture + "_" + tool_name + "_" + version;
78
79 String version_file_name = config_path + "/" + tool_name + ".ver";
80
81 // create version file if it doesn't exist yet
82 bool first_run(false);
83 if (!File::exists(version_file_name) || !File::readable(version_file_name))
84 {
85 // create OpenMS folder for .ver files
86 QDir dir(config_path.toQString());
87
88 if (!dir.exists())
89 {
90 dir.mkpath(".");
91 }
92

Callers 2

mainFunction · 0.45

Calls 14

setFileNameMethod · 0.80
setUrlMethod · 0.80
getResponseMethod · 0.80
getErrorStringMethod · 0.80
statClass · 0.70
StringClass · 0.50
QStringClass · 0.50
createFunction · 0.50
emptyMethod · 0.45
toQStringMethod · 0.45
existsMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected