You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
751 B
Plaintext
36 lines
751 B
Plaintext
2 years ago
|
#!/usr/bin/env python
|
||
|
|
||
|
"""
|
||
|
places the wsl instance into winmode
|
||
|
"""
|
||
|
|
||
|
import os
|
||
|
import pathlib
|
||
|
import subprocess
|
||
|
import shutil
|
||
|
|
||
|
env = os.environ
|
||
|
env['PS1'] = f"(W) {env['PS1']}"
|
||
|
|
||
|
path = env['PATH']
|
||
|
parts = path.split(':')
|
||
|
|
||
|
winbin_dir = pathlib.Path('/home/jorelli/.config/winbin')
|
||
|
winbin_dir.mkdir(parents=True, exist_ok=True)
|
||
|
|
||
|
links = {
|
||
|
'cargo': '/mnt/c/Users/jordan/.cargo/bin/cargo.exe',
|
||
|
'python': '/mnt/c/Users/jordan/AppData/Local/Microsoft/WindowsApps/python.exe',
|
||
|
}
|
||
|
|
||
|
for k, v in links.items():
|
||
|
target_path = winbin_dir / k
|
||
|
target_path.symlink_to(v)
|
||
|
|
||
|
parts.insert(0, '/home/jorelli/.config/winbin')
|
||
|
env['PATH'] = ':'.join(parts)
|
||
|
|
||
|
subprocess.run('/usr/bin/bash --norc', shell=True, check=False, env=env)
|
||
|
|
||
|
shutil.rmtree(winbin_dir)
|