#NEWLINE# def site_data_dir( appname = None , appauthor = None , version = None , multipath = False ) : #NEWLINE# #INDENT# 'Return full path to the user-shared data dir for this application.\n\n        "appname" is the name of application.\n            If None, just the system directory is returned.\n        "appauthor" (only used on Windows) is the name of the\n            appauthor or distributing body for this application. Typically\n            it is the owning company name. This falls back to appname. You may\n            pass False to disable it.\n        "version" is an optional version path element to append to the\n            path. You might want to use this if you want multiple versions\n            of your app to be able to run independently. If used, this\n            would typically be "<major>.<minor>".\n            Only applied when appname is present.\n        "multipath" is an optional parameter only applicable to *nix\n            which indicates that the entire list of data dirs should be\n            returned. By default, the first item from XDG_DATA_DIRS is\n            returned, or \'/usr/local/share/<AppName>\',\n            if XDG_DATA_DIRS is not set\n\n    Typical user data directories are:\n        Mac OS X:   /Library/Application Support/<AppName>\n        Unix:       /usr/local/share/<AppName> or /usr/share/<AppName>\n        Win XP:     C:\\Documents and Settings\\All Users\\Application Data\\<AppAuthor>\\<AppName>\n        Vista:      (Fail! "C:\\ProgramData" is a hidden *system* directory on Vista.)\n        Win 7:      C:\\ProgramData\\<AppAuthor>\\<AppName>   # Hidden, but writeable on Win 7.\n\n    For Unix, this is using the $XDG_DATA_DIRS[0] default.\n\n    WARNING: Do not use this on Windows. See the Vista-Fail note above for why.\n    ' #NEWLINE# if ( system == 'win32' ) : #NEWLINE# #INDENT# if ( appauthor is None ) : #NEWLINE# #INDENT# appauthor = appname #NEWLINE# #UNINDENT# path = os . path . normpath ( _get_win_folder ( 'CSIDL_COMMON_APPDATA' ) ) #NEWLINE# if multipath : #NEWLINE# #INDENT# if ( appauthor is not False ) : #NEWLINE# #INDENT# path = os . path . join ( path , appauthor , appname ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = os . path . join ( path , appname ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( system == 'darwin' ) : #NEWLINE# #INDENT# path = os . path . expanduser ( '/Library/Application Support' ) #NEWLINE# if appname : #NEWLINE# #INDENT# path = os . path . join ( path , appname ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# path = os . getenv ( 'XDG_DATA_DIRS' , os . pathsep . join ( [ '/usr/local/share' , '/usr/share' ] ) ) #NEWLINE# pathlist = [ os . path . expanduser ( x . rstrip ( os . sep ) ) for x in path . split ( os . pathsep ) ] #NEWLINE# if appname : #NEWLINE# #INDENT# if version : #NEWLINE# #INDENT# appname = os . path . join ( appname , version ) #NEWLINE# #UNINDENT# pathlist = [ os . sep . join ( [ x , appname ] ) for x in pathlist ] #NEWLINE# #UNINDENT# if multipath : #NEWLINE# #INDENT# path = os . pathsep . join ( pathlist ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = pathlist [ 0 ] #NEWLINE# #UNINDENT# return path #NEWLINE# #UNINDENT# #UNINDENT# if ( appname and version ) : #NEWLINE# #INDENT# path = os . path . join ( path , version ) #NEWLINE# #UNINDENT# return path