diff --git a/OBSReplay.lua b/OBSReplay.lua index 9f27117..a4f51c3 100755 --- a/OBSReplay.lua +++ b/OBSReplay.lua @@ -99,12 +99,23 @@ function save(event) local current_scene_name = get_current_scene_name() local scene_folder_path = output_path .. "/" .. current_scene_name - os.execute(('mkdir -p "%s"'):format(scene_folder_path)) + if package.config:sub(1, 1) == "\\" then + os.execute(('powershell -Command "if (!(Test-Path \\"%s\\")) { New-Item -ItemType Directory -Path \\"%s\\" }"') + :format(scene_folder_path, scene_folder_path)) + else + os.execute(('mkdir -p "%s"'):format(scene_folder_path)) + end local file_name = latest_file_path:match("([^/\\]+)$") local moved_file_path = scene_folder_path .. "/" .. file_name - local move_command = ('mv "%s" "%s"'):format(latest_file_path, moved_file_path) + local move_command + if package.config:sub(1, 1) == "\\" then + move_command = ('powershell -Command "Move-Item -Path \\"%s\\" -Destination \\"%s\\" -Force"') + :format(latest_file_path, moved_file_path) + else + move_command = ('mv "%s" "%s"'):format(latest_file_path, moved_file_path) + end print("Moving file:", move_command) os.execute(move_command) @@ -148,7 +159,12 @@ function save(event) end if delete_original then - local delete_command = ('rm "%s"'):format(moved_file_path) + local delete_command + if package.config:sub(1, 1) == "\\" then + delete_command = ('powershell -Command "Remove-Item -Path \\"%s\\" -Force"'):format(moved_file_path) + else + delete_command = ('rm "%s"'):format(moved_file_path) + end print("Deleting original:", delete_command) os.execute(delete_command) end