aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/osspecificaspects.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/utils/osspecificaspects.h')
-rw-r--r--src/libs/utils/osspecificaspects.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libs/utils/osspecificaspects.h b/src/libs/utils/osspecificaspects.h
index 0cc22efe5f..c735f313ab 100644
--- a/src/libs/utils/osspecificaspects.h
+++ b/src/libs/utils/osspecificaspects.h
@@ -14,6 +14,36 @@ namespace Utils {
// Add more as needed.
enum OsType { OsTypeWindows, OsTypeLinux, OsTypeMac, OsTypeOtherUnix, OsTypeOther };
+inline QString osTypeToString(OsType osType)
+{
+ switch (osType) {
+ case OsTypeWindows:
+ return "Windows";
+ case OsTypeLinux:
+ return "Linux";
+ case OsTypeMac:
+ return "Mac";
+ case OsTypeOtherUnix:
+ return "Other Unix";
+ case OsTypeOther:
+ default:
+ return "Other";
+ }
+}
+
+inline OsType osTypeFromString(const QString &string)
+{
+ if (string == "Windows")
+ return OsTypeWindows;
+ if (string == "Linux")
+ return OsTypeLinux;
+ if (string == "Mac")
+ return OsTypeMac;
+ if (string == "Other Unix")
+ return OsTypeOtherUnix;
+ return OsTypeOther;
+}
+
namespace OsSpecificAspects {
inline QString withExecutableSuffix(OsType osType, const QString &executable)