From 0529f1fe7ed9ac30f473919a55bd47f8d99d44ea Mon Sep 17 00:00:00 2001 From: Travis Abendshien Date: Tue, 23 Apr 2024 23:22:29 -0700 Subject: [PATCH] Fixed library creation bug inside of empty .TagStudio folder Fixed a library creation bug where the program would malfunction when trying to create a new library from a folder called ".TagStudio". --- tagstudio/src/core/library.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tagstudio/src/core/library.py b/tagstudio/src/core/library.py index f5196d31..06caf78b 100644 --- a/tagstudio/src/core/library.py +++ b/tagstudio/src/core/library.py @@ -536,14 +536,14 @@ class Library: Creates a TagStudio library in the given directory.\n Return Codes:\n 0: Library Successfully Created\n - 1: Path is inside another TagStudio Library\n 2: File creation error """ path = os.path.normpath(path).rstrip('\\') + # If '.TagStudio' is included in the path, trim the path up to it. if ts_core.TS_FOLDER_NAME in path: - return 1 + path = path.split(ts_core.TS_FOLDER_NAME)[0] try: self.clear_internal_vars() @@ -601,7 +601,7 @@ class Library: return_code: int = 2 path = os.path.normpath(path).rstrip('\\') - # Strip an errant '.TagStudio' from the path if the user pointed to that inner folder. + # If '.TagStudio' is included in the path, trim the path up to it. if ts_core.TS_FOLDER_NAME in path: path = path.split(ts_core.TS_FOLDER_NAME)[0]