Allows to export when using installer (#1568)

* fix export for packaged apps

* fix filename
This commit is contained in:
didierlopes.eth
2022-03-28 14:57:18 +01:00
committed by GitHub
parent f1ac594b41
commit 938e9bed87

View File

@@ -1159,8 +1159,25 @@ def export_data(
default_filename = f"{now.strftime('%Y%m%d_%H%M%S')}_{path_cmd}_{func_name}"
else:
full_path_dir = dir_path.replace("gamestonk_terminal", "exports")
default_filename = f"{func_name}_{now.strftime('%Y%m%d_%H%M%S')}"
if gtff.PACKAGED_APPLICATION:
default_filename = (
f"{now.strftime('%Y%m%d_%H%M%S')}_{path_cmd}_{func_name}"
)
full_path_dir = os.path.join(
os.environ["HOME"], "Desktop", "GST-exports"
)
if not os.path.isdir(full_path_dir):
try:
os.makedirs(full_path_dir)
except Exception:
console.print(
f"[red]Couldn't create a folder in {full_path_dir}. Exporting failed.[/red]"
)
return
else:
default_filename = f"{func_name}_{now.strftime('%Y%m%d_%H%M%S')}"
full_path_dir = dir_path.replace("gamestonk_terminal", "exports")
for exp_type in export_type.split(","):