d
This commit is contained in:
@@ -21,7 +21,7 @@ from pathlib import Path, PurePosixPath
|
||||
from threading import RLock
|
||||
from typing import Optional, Dict, Any, List, Tuple, Set
|
||||
|
||||
from SYS.utils import sha256_file
|
||||
from SYS.utils import sha256_file, expand_path
|
||||
from SYS.logger import debug as mm_debug
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -208,7 +208,7 @@ class API_folder_store:
|
||||
Args:
|
||||
library_root: Path to the local library root directory
|
||||
"""
|
||||
self.library_root = Path(library_root)
|
||||
self.library_root = expand_path(library_root)
|
||||
self.db_path = self.library_root / self.DB_NAME
|
||||
self.connection: Optional[sqlite3.Connection] = None
|
||||
# sqlite3 connections are not safe for concurrent use across threads.
|
||||
@@ -218,8 +218,13 @@ class API_folder_store:
|
||||
self._init_db()
|
||||
|
||||
def _normalize_input_path(self, file_path: Path) -> Path:
|
||||
p = Path(file_path).expanduser()
|
||||
p = expand_path(file_path)
|
||||
if not p.is_absolute():
|
||||
# Check if it already seems to start with library_root but just wasn't absolute
|
||||
# (e.g. library_root is "C:\foo" and p is "foo\bar" which might happen in some cases)
|
||||
# though usually it's better to just join.
|
||||
# But the recursive case happened because library_root was "$home/files" (not absolute)
|
||||
# and p was "$home/files/..." (not absolute).
|
||||
p = self.library_root / p
|
||||
return p
|
||||
|
||||
|
||||
Reference in New Issue
Block a user