added --storage-path argument to config
This commit is contained in:
parent
07a33f1ee4
commit
110b0a3543
@ -1,6 +1,24 @@
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="OpenRecall"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--storage-path",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Path to store the screenshots and database",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.storage_path:
|
||||
appdata_folder = args.storage_path
|
||||
screenshots_path = os.path.join(appdata_folder, "screenshots")
|
||||
db_path = os.path.join(appdata_folder, "recall.db")
|
||||
|
||||
def get_appdata_folder(app_name="openrecall"):
|
||||
if sys.platform == "win32":
|
||||
@ -18,10 +36,14 @@ def get_appdata_folder(app_name="openrecall"):
|
||||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
|
||||
appdata_folder = get_appdata_folder()
|
||||
db_path = os.path.join(appdata_folder, "recall.db")
|
||||
screenshots_path = os.path.join(appdata_folder, "screenshots")
|
||||
if args.storage_path:
|
||||
appdata_folder = args.storage_path
|
||||
screenshots_path = os.path.join(appdata_folder, "screenshots")
|
||||
db_path = os.path.join(appdata_folder, "recall.db")
|
||||
else:
|
||||
appdata_folder = get_appdata_folder()
|
||||
db_path = os.path.join(appdata_folder, "recall.db")
|
||||
screenshots_path = os.path.join(appdata_folder, "screenshots")
|
||||
|
||||
if not os.path.exists(screenshots_path):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user