summaryrefslogtreecommitdiff
path: root/src/libs/utils/hostosinfo.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@nokia.com>2012-08-31 16:39:20 +0200
committerChristian Kandeler <christian.kandeler@nokia.com>2012-09-05 13:54:48 +0200
commit3c6f76d16c142c2b98564fc9167b67564ead7fe5 (patch)
treea30f0a3dfaf44d7712b9511f4860811d87c821dc /src/libs/utils/hostosinfo.h
parent16a1a2653a7f2cc0093c0ade7a31808d776fd103 (diff)
downloadqt-creator-3c6f76d16c142c2b98564fc9167b67564ead7fe5.tar.gz
HostOsInfo: Add some more useful abstractions.
Namely: - path list separator - executable suffix - file name case sensitivity All of these are duplicated in various places in the current Creator code. Change-Id: I86eb4662fa3c2071759bd728cae1aaf7111ae686 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/libs/utils/hostosinfo.h')
-rw-r--r--src/libs/utils/hostosinfo.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libs/utils/hostosinfo.h b/src/libs/utils/hostosinfo.h
index 84df1f0547..b5d85f2c62 100644
--- a/src/libs/utils/hostosinfo.h
+++ b/src/libs/utils/hostosinfo.h
@@ -32,6 +32,14 @@
#include "utils_global.h"
+#include <QString>
+
+#ifdef Q_OS_WIN
+#define QTC_HOST_EXE_SUFFIX ".exe"
+#else
+#define QTC_HOST_EXE_SUFFIX ""
+#endif // Q_OS_WIN
+
namespace Utils {
class QTCREATOR_UTILS_EXPORT HostOsInfo
@@ -46,6 +54,24 @@ public:
static bool isLinuxHost() { return hostOs() == HostOsLinux; }
static bool isMacHost() { return hostOs() == HostOsMac; }
static inline bool isAnyUnixHost();
+
+ static QString appendExecutableSuffix(const QString &executable)
+ {
+ QString finalName = executable;
+ if (isWindowsHost())
+ finalName += QLatin1String(QTC_HOST_EXE_SUFFIX);
+ return finalName;
+ }
+
+ static Qt::CaseSensitivity fileNameCaseSensitivity()
+ {
+ return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
+ }
+
+ static QChar pathListSeparator()
+ {
+ return isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
+ }
};
HostOsInfo::HostOs HostOsInfo::hostOs()