Skip to content

Commit

Permalink
Merge pull request #1003 from md11235/master
Browse files Browse the repository at this point in the history
Fixup getting project path on Windows
  • Loading branch information
manateelazycat committed Jul 31, 2024
2 parents 4d1e7c1 + 5c85839 commit 37583f0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,17 @@ def get_project_path(filepath):
import os
dir_path = os.path.dirname(filepath)
if get_command_result("git rev-parse --is-inside-work-tree", dir_path) == "true":
return get_command_result("git rev-parse --show-toplevel", dir_path)
path_from_git = get_command_result("git rev-parse --show-toplevel", dir_path)
if get_os_name() == "windows":
path_parts = path_from_git.split("/")
# if this is a Unix-style absolute path, which should be a Windows-style one
if path_parts[0] == "/":
windows_path = path_parts[1] + ":/" + "/".join(path_parts[2:])
return windows_path
else:
return path_from_git
else:
return path_from_git
else:
return filepath

Expand Down

0 comments on commit 37583f0

Please sign in to comment.