Skip to content

Commit

Permalink
Avoid os.symlink on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
willend committed Jul 11, 2024
1 parent 90c689b commit a13a2a0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/Python/mcdisplay/webgl/mcdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from http.server import HTTPServer, SimpleHTTPRequestHandler
import threading
import socket

if os.name=='nt':
import _winapi

sys.path.append(str(Path(__file__).resolve().parent.parent.parent))

Expand Down Expand Up @@ -116,7 +117,10 @@ def copy(a, b):
node_modules_source = source.joinpath('node_modules')
node_modules_dest = dest.joinpath('node_modules')
try:
os.symlink(node_modules_source, node_modules_dest)
if not os.name=='nt':
os.symlink(node_modules_source, node_modules_dest)
else:
_winapi.CreateJunction(node_modules_source, node_modules_dest)
except:
copytree(node_modules_source, node_modules_dest, dirs_exist_ok=True, ignore=ignore_patterns('*.log', '*.cache'))

Expand Down

0 comments on commit a13a2a0

Please sign in to comment.