| 33 | namespace 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 |
no test coverage detected