From b70a89d0e1c5f130d8538e05eb889e9fcc21ec8c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 4 Sep 2017 14:08:03 +0200 Subject: [PATCH] Fix stdout and stderr redirecting file location --- cura_app.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cura_app.py b/cura_app.py index 1d8867f1f4..2e406f99d3 100755 --- a/cura_app.py +++ b/cura_app.py @@ -54,8 +54,17 @@ import Arcus #@UnusedImport import cura.CuraApplication import cura.Settings.CuraContainerRegistry +def get_cura_dir_path(): + if Platform.isWindows(): + return os.path.expanduser("~/AppData/Local/cura/") + elif Platform.isLinux(): + return os.path.expanduser("~/.local/share/cura") + elif Platform.isOSX(): + return os.path.expanduser("~/Library/Application Support/cura") + + if hasattr(sys, "frozen"): - dirpath = os.path.expanduser("~/AppData/Local/cura/") + dirpath = get_cura_dir_path() os.makedirs(dirpath, exist_ok = True) sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w") sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")