def SetEnvTempDir(path): if os.path.exists(path) and not os.path.isdir(path): raise Exception( 'The given temp directory, "{}", does not seem to be a directory!'. format(path)) try: HydrusPaths.MakeSureDirectoryExists(path) except Exception as e: raise Exception('Could not create the temp dir: {}'.format(e)) if not HydrusPaths.DirectoryIsWriteable(path): raise Exception( 'The given temp directory, "{}", does not seem to be writeable-to!' .format(path)) for tmp_name in ('TMPDIR', 'TEMP', 'TMP'): if tmp_name in os.environ: os.environ[tmp_name] = path tempfile.tempdir = path
help='print additional bootup information to the log') argparser.add_argument('--no_wal', action='store_true', help='OBSOLETE: run using TRUNCATE db journaling') argparser.add_argument( '--db_memory_journaling', action='store_true', help='OBSOLETE: run using MEMORY db journaling (DANGEROUS)') result = argparser.parse_args() if result.db_dir is None: db_dir = HC.DEFAULT_DB_DIR if not HydrusPaths.DirectoryIsWriteable( db_dir) or HC.RUNNING_FROM_MACOS_APP: if HC.USERPATH_DB_DIR is None: raise Exception( 'The default db path "{}" was not writeable, and the userpath could not be determined!' .format(HC.DEFAULT_DB_DIR)) db_dir = HC.USERPATH_DB_DIR else: db_dir = result.db_dir db_dir = HydrusPaths.ConvertPortablePathToAbsPath(db_dir, HC.BASE_DIR)