-import wx
-
-def isWindows():
- return os.name == 'nt'
-
-def _generateDocumentsDir():
- path = ""
- if sys.platform == "win32":
- from win32com.shell import shell, shellcon
- path=shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
- elif sys.platform == "darwin":
- import macfs, MACFS
- fsspec_disk, fsspec_desktop = macfs.FindFolder( MACFS.kOnSystemDisk, MACFS.kDocumentsFolderType, 0)
- path = macfs.FSSpec((fsspec_disk, fsspec_desktop, '')).as_pathname()
-
- if path == "":
- path = os.path.expanduser("~")
-
- return path
+import activegrid.util.sysutils as sysutils
+
+def _getSystemDir(kind):
+ if (kind == AG_LOGS_DIR):
+ return os.path.join(getSystemDir(AG_SYSTEM_DIR) , "logs")
+ elif (kind == AG_DEMOS_DIR):
+ return os.path.join(getSystemDir(AG_SYSTEM_DIR), "demos")
+ else:
+ path = ""
+ if (sysutils.isServer()):
+ path = os.getenv("ACTIVEGRID_SERVER_HOME")
+ if ((path is None) or (len(path) < 1)):
+ path = sysutils.mainModuleDir
+ else:
+ path = os.getenv("AG_DOCUMENTS_DIR")
+ if ((path is None) or (len(path) < 1)):
+ if sysutils.isWindows():
+ ifDefPy()
+ try:
+ from win32com.shell import shell, shellcon
+ path = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
+ except:
+ pass
+ endIfDef()
+ if ((path is None) or (len(path) < 1)):
+ homedrive = asString(os.getenv("HOMEDRIVE"))
+ homepath = os.getenv("HOMEPATH")
+## if ((homedrive is not None) and (len(homedrive) > 0) and (homepath is not None) and (len(homepath) > 0)):
+ path = os.path.join(homedrive, homepath, "MYDOCU~1")
+ else:
+ ifDefPy()
+ if sys.platform == "darwin":
+ try:
+ import macfs
+ import MACFS
+ fsspec_disk, fsspec_desktop = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kDocumentsFolderType, 0)
+ path = macfs.FSSpec((fsspec_disk, fsspec_desktop, '')).as_pathname()
+ except:
+ pass
+ endIfDef()
+
+ ifDefPy()
+ if ((path is None) or (len(path) < 1)):
+ path = os.path.expanduser("~")
+ endIfDef()
+ if ((path is None) or (len(path) < 1)):
+ path = "/"
+ path = os.path.join(path, "ActiveGrid")