Skip to content

Commit 5d73d34

Browse files
committed
fixed file path_name issue
1 parent 05a9d61 commit 5d73d34

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

flaskcode/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def write_file(content, filepath, encoding='utf-8', chunk_size=None):
3636
def dir_tree(abs_path, abs_root_path, exclude_names=None, excluded_extensions=None, allowed_extensions=None):
3737
tree = dict(
3838
name=os.path.basename(abs_path),
39-
path_name=abs_path[len(abs_root_path):].lstrip('/\\'),# TODO: use os.path.relpath
39+
path_name=abs_path[len(abs_root_path):].replace('\\', '/').lstrip('/'), # TODO: use os.path.relpath
4040
children=[]
4141
)
4242
try:
@@ -61,7 +61,7 @@ def dir_tree(abs_path, abs_root_path, exclude_names=None, excluded_extensions=No
6161
continue
6262
tree['children'].append(dict(
6363
name=os.path.basename(new_path),
64-
path_name=new_path[len(abs_root_path):].lstrip('/\\'),# TODO: use os.path.relpath
64+
path_name=new_path[len(abs_root_path):].replace('\\', '/').lstrip('/'), # TODO: use os.path.relpath
6565
is_file=True,
6666
))
6767
return tree

0 commit comments

Comments
 (0)