Skip to content

Commit

Permalink
go back from home as well
Browse files Browse the repository at this point in the history
  • Loading branch information
flashnuke committed Oct 5, 2024
1 parent 3031db8 commit c38285a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions systamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ def list_files_and_directories(self, path: str):
buttons.append(InlineKeyboardButton(entry, callback_data=f"file {entry_hashed}"))

# Add "Back" button to navigate to the parent directory if not at the root
if path != str(Path.home()): # If we are not in the home directory
parent_directory = os.path.dirname(path) # Get parent directory
if os.path.isdir(parent_directory): # Ensure the parent directory is valid
parent_hashed = hashlib.md5(parent_directory.encode()).hexdigest()
self._browse_path_dict[parent_hashed] = parent_directory
buttons.append(InlineKeyboardButton("⬅️ Back", callback_data=f"cd {parent_hashed}"))
# if path != str(Path.home()): # If we are not in the home directory
parent_directory = os.path.dirname(path) # Get parent directory
if os.path.isdir(parent_directory): # Ensure the parent directory is valid
parent_hashed = hashlib.md5(parent_directory.encode()).hexdigest()
self._browse_path_dict[parent_hashed] = parent_directory
buttons.append(InlineKeyboardButton("⬅️ Back", callback_data=f"cd {parent_hashed}"))
buttons.append(InlineKeyboardButton("❌️ Close", callback_data=f"action close"))
return buttons

Expand Down

0 comments on commit c38285a

Please sign in to comment.