Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup getting project path on Windows #1003

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,13 @@ 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":
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should change to:

if get_os_name() == "windows" and path_from_git.startswith("/"):

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or only run convert code when env is MSYS2

path_parts = path_from_git.split("/")
windows_path = path_parts[1] + ":/" + "/".join(path_parts[2:])
return windows_path
else:
return path_from_git
else:
return filepath

Expand Down
Loading