fix dir match
This commit is contained in:
parent
8a4202cee5
commit
f7ca4abb01
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ class DirectoryHelper:
|
|||||||
for matched_dir in matched_dirs:
|
for matched_dir in matched_dirs:
|
||||||
try:
|
try:
|
||||||
# 计算in_path和path的公共字符串长度
|
# 计算in_path和path的公共字符串长度
|
||||||
relative_len = len(StringUtils.find_common_prefix(str(in_path), matched_dir.path))
|
relative_len = len(StringUtils.find_common_prefix(str(in_path), str(Path(matched_dir.path))))
|
||||||
if len(str(matched_dir.path)) == relative_len \
|
if len(str(matched_dir.path)) == relative_len \
|
||||||
and relative_len >= max_length:
|
and relative_len >= max_length:
|
||||||
# 目录完整匹配且是最长的,直接返回
|
# 目录完整匹配且是最长的,直接返回
|
||||||
|
Loading…
x
Reference in New Issue
Block a user