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".
This commit is contained in:
Travis Abendshien
2024-04-23 23:22:29 -07:00
parent 59be7c0cf9
commit 0529f1fe7e

View File

@@ -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]