Skip to content

Commit

Permalink
more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Jun 8, 2024
1 parent de70439 commit 029b65e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ubelt/_win32_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def _win32_symlink(path, link, verbose=0):
specially enabled symlink permissions. On Windows 10 enabling developer
mode should give you these permissions.
"""
if verbose >= 3:
print(f'_win32_symlink {link} -> {path}')

from ubelt import util_cmd
if os.path.isdir(path):
# directory symbolic link
Expand All @@ -269,7 +272,8 @@ def _win32_symlink(path, link, verbose=0):
command = 'mklink "{}" "{}"'.format(link, path)

if command is not None:
info = util_cmd.cmd(command, shell=True)
cmd_verbose = verbose >= 3
info = util_cmd.cmd(command, shell=True, verbose=cmd_verbose)
if info['ret'] != 0:
from ubelt import util_repr
permission_msg = 'You do not have sufficient privledge'
Expand Down Expand Up @@ -317,11 +321,14 @@ def _win32_junction(path, link, verbose=0):
path = os.path.abspath(path)
link = os.path.abspath(link)

if verbose >= 3:
print(f'_win32_junction {link} -> {path}')

from ubelt import util_cmd
if os.path.isdir(path):
# try using a junction (soft link)
if verbose:
print('... as soft link')
print('... as soft link (junction)')

# TODO: what is the windows api for this?
command = 'mklink /J "{}" "{}"'.format(link, path)
Expand All @@ -338,7 +345,8 @@ def _win32_junction(path, link, verbose=0):
command = None

if command is not None:
info = util_cmd.cmd(command, shell=True)
cmd_verbose = verbose >= 3
info = util_cmd.cmd(command, shell=True, verbose=cmd_verbose)
if info['ret'] != 0:
from ubelt import util_repr
print('Failed command:')
Expand Down

0 comments on commit 029b65e

Please sign in to comment.