Skip to content

Commit

Permalink
fix --dot and add path user expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Dec 2, 2024
1 parent 5b759d2 commit b434b0d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cat_win/src/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get_files(self, dot_files: bool = False) -> list:
path_name = norm_path
if not norm_exists or (lit_exists and not p_equal):
path_name = lit_path
if norm_exists or lit_exists:
if (norm_exists or lit_exists) and (dot_files or not path_name.name.startswith('.')):
self._known_files.append(path_name)
continue
norm_exists, lit_exists = False, False
Expand All @@ -160,12 +160,19 @@ def get_files(self, dot_files: bool = False) -> list:
path_name = norm_path
if not norm_exists or (lit_exists and not p_equal):
path_name = lit_path
if norm_exists or lit_exists:
if (norm_exists or lit_exists) and (dot_files or not path_name.name.startswith('.')):
self._known_directories.append(path_name)

return self._known_files

def _add_path_struct(self, param: str) -> bool:
provided_path = Path(param)
if provided_path.parts[0] == '~':
if (
not os.path.exists('~') or
os.path.isfile('~') and len(provided_path.parts) > 1
):
param = os.path.expanduser(param)
norm_path = Path(os.path.realpath(param))
lit_path = Path(f"{self.win_prefix_lit}{norm_path.parent}/{Path(param).name}")
p_equal = lit_path.stem == norm_path.stem
Expand Down

0 comments on commit b434b0d

Please sign in to comment.