diff --git a/ostools.py b/ostools.py index 294437f..f3d0126 100644 --- a/ostools.py +++ b/ostools.py @@ -1,18 +1,36 @@ -from os import path -from sys import platform +import os, sys +import platform from PyQt4.QtGui import QDesktopServices def isOSX(): - return platform == "darwin" + return sys.platform == "darwin" def isWin32(): - return platform == "win32" + return sys.platform == "win32" + +def isLinux(): + return sys.platform.startswith("linux") def isOSXBundle(): - return isOSX() and (path.abspath('.').find(".app") != -1) + return isOSX() and (os.path.abspath('.').find(".app") != -1) + +def osVer(): + if isWin32(): + return " ".join(platform.win32_ver()) + elif isOSX(): + ret = "" + for i in platform.mac_ver(): + if type(i) == type(tuple()): + for j in i: + ret += " %s" % (j) + else: + ret += " %s" % (i) + return ret[1:] + elif isLinux(): + return " ".join(platform.linux_distribution()) def getDataDir(): if isOSX(): - return path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") + return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") else: return ''