mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 14:21:33 +03:00
Rename dir_name -> path_segment since it can refer to a file
This commit is contained in:
parent
1f260aaeef
commit
e9218e1c75
@ -9,13 +9,13 @@ class EnhancedDirectoryTree(DirectoryTree):
|
|||||||
node = self.root
|
node = self.root
|
||||||
def get_node_name(node):
|
def get_node_name(node):
|
||||||
return os.path.basename(node.data.path.rstrip(os.path.sep))
|
return os.path.basename(node.data.path.rstrip(os.path.sep))
|
||||||
for dir_name in target_path.split(os.path.sep):
|
for path_segment in target_path.split(os.path.sep):
|
||||||
# Find the child node with the right name.
|
# Find the child node with the right name.
|
||||||
for child in node.children:
|
for child in node.children:
|
||||||
if get_node_name(child) == dir_name:
|
if get_node_name(child) == path_segment:
|
||||||
node = child
|
node = child
|
||||||
break
|
break
|
||||||
if get_node_name(node) == dir_name:
|
if get_node_name(node) == path_segment:
|
||||||
if node.data.is_dir:
|
if node.data.is_dir:
|
||||||
if not node.is_expanded and not node.data.loaded:
|
if not node.is_expanded and not node.data.loaded:
|
||||||
# load_directory also calls node.expand()
|
# load_directory also calls node.expand()
|
||||||
|
Loading…
Reference in New Issue
Block a user