diff --git a/lfs_lock_parser.py b/lfs_lock_parser.py index a718a75..624cee1 100644 --- a/lfs_lock_parser.py +++ b/lfs_lock_parser.py @@ -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 = [] diff --git a/locking_widgets.py b/locking_widgets.py index bd33007..5bff58c 100644 --- a/locking_widgets.py +++ b/locking_widgets.py @@ -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" diff --git a/utility.py b/utility.py index f0e70e0..18b635f 100644 --- a/utility.py +++ b/utility.py @@ -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() @@ -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): @@ -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