Addressed issues when running basic-memory on the Windows platform (#252)

Signed-off-by: Manuel Bliemel <manuel.bliemel@gmail.com>
This commit is contained in:
manuelbliemel
2025-08-25 04:12:40 +02:00
committed by GitHub
parent 7aff836c57
commit 9aa40246a8
21 changed files with 93 additions and 70 deletions
+13 -1
View File
@@ -49,7 +49,7 @@ def generate_permalink(file_path: Union[Path, str, PathLike]) -> str:
'中文/测试文档'
"""
# Convert Path to string if needed
path_str = str(file_path)
path_str = Path(str(file_path)).as_posix()
# Remove extension
base = os.path.splitext(path_str)[0]
@@ -220,6 +220,18 @@ def parse_tags(tags: Union[List[str], str, None]) -> List[str]:
return []
def normalize_newlines(multiline: str) -> str:
"""Replace any \r\n, \r, or \n with the native newline.
Args:
multiline: String containing any mixture of newlines.
Returns:
A string with normalized newlines native to the platform.
"""
return re.sub(r'\r\n?|\n', os.linesep, multiline)
def normalize_file_path_for_comparison(file_path: str) -> str:
"""Normalize a file path for conflict detection.