Created
April 4, 2021 07:20
-
-
Save Qwaz/fda845df4cc6ba3c64fe3960315f1b29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Set in SumatraPDF | |
# wsl /home/qwaz/open-in-wsl.py "%f:%l" | |
# Original path: | |
# \wsl$\Ubuntu\home\qwaz\tex\p.tex:123 | |
# Modified path: | |
# /home/qwaz/tex/p.tex:123 | |
import os | |
import subprocess | |
import sys | |
location = sys.argv[1] | |
splitted = location.split("\\") | |
wsl_index = splitted.index("wsl$") | |
location = "/" + "/".join(splitted[wsl_index + 2:]) | |
subprocess.run(["code", "-r", "-g", location]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment