Skip to content

Commit

Permalink
Fix custom Git LFS not found
Browse files Browse the repository at this point in the history
Also, normalize project root directory path.
  • Loading branch information
chillpert committed Feb 3, 2024
1 parent 75794c1 commit f5112c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lfs_lock_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def _parse_locks():
# Get the lines of the output as a list
project_root = Utility.get_project_root_directory()

command = Utility.get_git_lfs_path() + " locks"
git_lfs_path = Utility.get_git_lfs_path()

# Use backwards slash on Windows, so we can run in cmd
if Utility.get_platform() == Utility.Platform.Windows:
git_lfs_path = git_lfs_path.replace("/", "\\")

command = git_lfs_path + " locks"
lines = Utility.run_command_and_output_list_of_lines(command, project_root)

data = []
Expand Down
2 changes: 1 addition & 1 deletion locking_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _exec_locking_operation_on_file_list(file_list: [], should_lock: bool):
Utility.get_project_root_directory() + git_lfs_path):
print(
"Using custom git LFS at '%s'" % (Utility.get_project_root_directory() + Settings.custom_git_lfs_path))
git_command += Settings.custom_git_lfs_path
git_command += git_lfs_path
# Use default
else:
git_command += "git lfs"
Expand Down
9 changes: 6 additions & 3 deletions utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def run_command(command, directory):
try:
# Execute the command in a subprocess
split_command = command.split()
process = subprocess.Popen(split_command, cwd=root, stdout=subprocess.PIPE)
print("Command to run: " + command + " in cwd: " + root)
process = subprocess.Popen(split_command, cwd=root, stdout=subprocess.PIPE, shell=True)

# Wait for the process to finish and capture the output
stdout, stderr = process.communicate()
Expand Down Expand Up @@ -159,7 +160,7 @@ def get_git_lfs_path():
# Verify executable for Windows
if platform == Utility.Platform.Windows:
if os.path.isfile(project_root + custom_git_lfs_path + ".exe"):
Utility.get_git_lfs_path.git_lfs_path = custom_git_lfs_path
Utility.get_git_lfs_path.git_lfs_path = custom_git_lfs_path + ".exe"
# Verify executable for Linux
elif platform == Utility.Platform.Linux:
if os.path.isfile(project_root + custom_git_lfs_path):
Expand All @@ -186,7 +187,9 @@ def get_git_lfs_path():
@staticmethod
def get_project_root_directory():
full_path = os.path.join(os.getcwd(), Settings.project_root_directory)
return Utility.format_path(os.path.join(full_path, ''))
full_path = os.path.normpath(full_path)
full_path = os.path.join(full_path, '')
return full_path

class Platform(Enum):
Windows = 1
Expand Down

0 comments on commit f5112c1

Please sign in to comment.