(manual=False)
get the data directory. If manual is True, it will try to retrieve the manually set value instead of the Container
get the data directory. If manual is True, it will try to retrieve the manually set value instead of the Container
get the data directory . If manual is True it will try to retrieve the manually set value instead of the Container
def get_data_dir(manual=False):
        '''get the data directory. If manual is True, it will try to retrieve the manually set value instead of the Container'''
        # cache the data dir
        data_dir = ''
        if not manual:
            data_dir = Container.get("Environment:data_dir")
            if data_dir:
                return data_dir

        install_dir = Environment.get_install_dir()
        dirs = install_dir.split('/')
        dirs.pop()
        base_dir = '/'.join(dirs) 
        if hasattr(tacticenv, 'get_data_dir'):
            # verify user-defined data dir is under the base dir for Linux and ProgramData for Windows
            data_dir = tacticenv.get_data_dir()
            if not data_dir:
                # choose some arbitrary default
                if os.name == 'nt':
                    data_dir = 'C:/ProgramData/Tactic/Data'
                else:    
                    install_dir = Environment.get_install_dir()
                    dirs = install_dir.split('/')
                    dirs.pop()
                    data_dir = '%s/tactic_data' % base_dir
            else:
                data_dir = data_dir.replace("\\", "/")
     
            Container.put("Environment:data_dir", data_dir)

            return data_dir

        elif not manual:
            # this is consistent with install.py
            if os.name == 'nt':
                data_dir = 'C:/ProgramData/Tactic/Data'
            else:    
                install_dir = Environment.get_install_dir()
                dirs = install_dir.split('/')
                dirs.pop()
                data_dir = '%s/tactic_data' % base_dir
            
            Container.put("Environment:data_dir", data_dir)
            return data_dir
def get_data_dir ( manual = False ) : # cache the data dir data_dir = '' if not manual : data_dir = Container . get ( "Environment:data_dir" ) if data_dir : return data_dir install_dir = Environment . get_install_dir ( ) dirs = install_dir . split ( '/' ) dirs . pop ( ) base_dir = '/' . join ( dirs ) if hasattr ( tacticenv , 'get_data_dir' ) : # verify user-defined data dir is under the base dir for Linux and ProgramData for Windows data_dir = tacticenv . get_data_dir ( ) if not data_dir : # choose some arbitrary default if os . name == 'nt' : data_dir = 'C:/ProgramData/Tactic/Data' else : install_dir = Environment . get_install_dir ( ) dirs = install_dir . split ( '/' ) dirs . pop ( ) data_dir = '%s/tactic_data' % base_dir else : data_dir = data_dir . replace ( "\\" , "/" ) Container . put ( "Environment:data_dir" , data_dir ) return data_dir elif not manual : # this is consistent with install.py if os . name == 'nt' : data_dir = 'C:/ProgramData/Tactic/Data' else : install_dir = Environment . get_install_dir ( ) dirs = install_dir . split ( '/' ) dirs . pop ( ) data_dir = '%s/tactic_data' % base_dir Container . put ( "Environment:data_dir" , data_dir ) return data_dir