From 89f8a1362a0ea6916b32bd9de5fdf4543d07cf41 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 21 Mar 2024 16:50:07 +0100 Subject: [PATCH] determine OS to correctly save journal file and to switch back to one-branch development for convenience --- journal.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/journal.py b/journal.py index d46a5ca..c0ed4e7 100755 --- a/journal.py +++ b/journal.py @@ -11,7 +11,13 @@ YEAR = now.strftime("%Y") MONTH = now.strftime("%m") DAY = now.strftime("%d") journal_filename = "%s-%s-%s-Journal.txt" % (YEAR, MONTH, DAY) -journal_filename_path = "./%s" % journal_filename + +# determine OS to correctly save journal file and to switch back to one-branch development for convenience +if os.name == 'posix': + journal_filename_path = "./%s" % journal_filename + +if os.name == 'nt': + journal_filename_path = "$Env:AppData/%s" % journal_filename if not os.path.exists(journal_filename_path): with open(journal_filename_path, "w"):