Skip to content

Commit

Permalink
#bug0000 fixed but it still gives a loop in sym link
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-davee committed Nov 10, 2021
1 parent c19dcbd commit 7483dac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions magic_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ def add(self,tool_name):
adds a tool named tool_name if exist
"""
cwd = Path.cwd()
files = [cwd / f for f in {'tool_box','tool_box/mtb.yml'}]
files = [cwd / f for f in ['tool_box','tool_box/mtb.yml']]
if not all([f.exists() for f in files]): self.init()
tool_box, mtb = files
debug_msg = f"""
{getframeinfo(currentframe())=}
Whats is cwd?: {cwd=}
what is {files=}?
Is {yes_or_no(f'{tool_box=} a directory?', tool_box.is_dir())}
{yes_or_no(f'{mtb=} exists?', mtb.exists())}
What is {mtb=}?
Expand Down Expand Up @@ -84,11 +85,14 @@ def add(self,tool_name):

des = (tool_box / tool_name)
src = ( self.mwd / tool_name)


debug_msg = f"""
what is {str(des.absolute())=}?
what is {str(src.absolute())=}
{yes_or_no('is src == des?', src == des)}"""
logger.debug(debug_msg)
assert des != src, f"""{yes_or_no(f'is {des=} equal to {src=}?', des == src)}"""

if des.is_symlink():
des.unlink()
Expand All @@ -99,7 +103,7 @@ def add(self,tool_name):
above should have fixed it"""
logger.debug(debug_msg)

des.symlink_to(src)
des.symlink_to(src, target_is_directory=True)
debug_msg = f"""
{yes_or_no(f'is {des=} as sym link?', des.is_symlink())}"""
logger.debug(debug_msg)
Expand Down
1 change: 1 addition & 0 deletions tool_box/ask
Empty file added tool_box/mtb.yml
Empty file.

0 comments on commit 7483dac

Please sign in to comment.