Exemplo n.º 1
0
def GetExportPath():
    
    portable_path = HG.client_controller.options[ 'export_path' ]
    
    if portable_path is None:
        
        desired_path = os.path.join( '~', 'hydrus_export' )
        
        path = os.path.expanduser( desired_path )
        
        if path == desired_path:
            
            # could not figure it out, probably crazy user setup atm
            
            return None
            
        
        HydrusPaths.MakeSureDirectoryExists( path )
        
    else:
        
        path = HydrusPaths.ConvertPortablePathToAbsPath( portable_path )
        
    
    return path
Exemplo n.º 2
0
def GetExportPath():

    portable_path = HG.client_controller.options['export_path']

    if portable_path is None:

        path = os.path.join(os.path.expanduser('~'), 'hydrus_export')

        HydrusPaths.MakeSureDirectoryExists(path)

    else:

        path = HydrusPaths.ConvertPortablePathToAbsPath(portable_path)

    return path
Exemplo n.º 3
0
    result = argparser.parse_args()

    if result.db_dir is None:

        db_dir = HC.DEFAULT_DB_DIR

        if not HydrusPaths.DirectoryIsWritable(
                db_dir) or HC.RUNNING_FROM_MACOS_APP:

            db_dir = HC.USERPATH_DB_DIR

    else:

        db_dir = result.db_dir

    db_dir = HydrusPaths.ConvertPortablePathToAbsPath(db_dir, HC.BASE_DIR)

    try:

        HydrusPaths.MakeSureDirectoryExists(db_dir)

    except:

        raise Exception(
            'Could not ensure db path "{}" exists! Check the location is correct and that you have permission to write to it!'
            .format(db_dir))

    if not os.path.isdir(db_dir):

        raise Exception(
            'The given db path "{}" is not a directory!'.format(db_dir))