Skip to content

Commit

Permalink
Merge pull request #276 from TheRijn/wsl-html-url
Browse files Browse the repository at this point in the history
Show html path within wsl
  • Loading branch information
rongxin-liu authored Sep 21, 2022
2 parents 41406fc + 679598b commit 73736ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion check50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from json import JSONDecodeError
import logging
import os
import platform
import site
from pathlib import Path
import shutil
Expand Down Expand Up @@ -406,7 +407,13 @@ def main():
html = renderer.to_html(**results)
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".html") as html_file:
html_file.write(html)
url = f"file://{html_file.name}"

if "microsoft-standard" in platform.uname().release:
stream = os.popen(f"wslpath -m {html_file.name}")
wsl_path = stream.read().strip()
url = f"file://{wsl_path}"
else:
url = f"file://{html_file.name}"
else:
url = f"https://submit.cs50.io/check50/{tag_hash}"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"console_scripts": ["check50=check50.__main__:main"]
},
url="https://github.com/cs50/check50",
version="3.3.6",
version="3.3.7",
include_package_data=True
)

0 comments on commit 73736ec

Please sign in to comment.