2011-08-23 05:28:58 -04:00
|
|
|
import os, sys
|
|
|
|
import platform
|
2011-08-11 04:17:53 -04:00
|
|
|
from PyQt4.QtGui import QDesktopServices
|
|
|
|
|
|
|
|
def isOSX():
|
2011-08-23 05:28:58 -04:00
|
|
|
return sys.platform == "darwin"
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def isWin32():
|
2011-08-23 05:28:58 -04:00
|
|
|
return sys.platform == "win32"
|
|
|
|
|
|
|
|
def isLinux():
|
|
|
|
return sys.platform.startswith("linux")
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def isOSXBundle():
|
2011-08-23 05:28:58 -04:00
|
|
|
return isOSX() and (os.path.abspath('.').find(".app") != -1)
|
|
|
|
|
2011-09-22 06:23:33 -04:00
|
|
|
def isOSXLeopard():
|
|
|
|
return isOSX() and platform.mac_ver()[0].startswith("10.5")
|
|
|
|
|
2011-08-23 05:28:58 -04:00
|
|
|
def osVer():
|
|
|
|
if isWin32():
|
|
|
|
return " ".join(platform.win32_ver())
|
|
|
|
elif isOSX():
|
2011-09-22 06:23:33 -04:00
|
|
|
ver = platform.mac_ver();
|
|
|
|
return " ".join((ver[0], " (", ver[2], ")"))
|
2011-08-23 05:28:58 -04:00
|
|
|
elif isLinux():
|
|
|
|
return " ".join(platform.linux_distribution())
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def getDataDir():
|
|
|
|
if isOSX():
|
2011-12-16 12:25:41 -05:00
|
|
|
return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/")
|
2011-11-29 00:15:19 -05:00
|
|
|
elif isLinux():
|
2011-12-16 12:25:41 -05:00
|
|
|
return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/")
|
2011-08-11 04:17:53 -04:00
|
|
|
else:
|
2011-12-16 12:25:41 -05:00
|
|
|
return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/")
|