mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Update task.rb
Modify all potentially case sensitive file operations to operate in a case-insensitive manner.
This commit is contained in:
@@ -112,6 +112,11 @@ class W3DHub
|
|||||||
@task_state == :failed
|
@task_state == :failed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helper method to normalize file paths for case-insensitive comparison
|
||||||
|
def normalize_path(path)
|
||||||
|
path.to_s.gsub("\\", "/").downcase
|
||||||
|
end
|
||||||
|
|
||||||
def failure_reason
|
def failure_reason
|
||||||
@task_failure_reason || ""
|
@task_failure_reason || ""
|
||||||
end
|
end
|
||||||
@@ -259,7 +264,7 @@ class W3DHub
|
|||||||
next if packages.detect do |pkg|
|
next if packages.detect do |pkg|
|
||||||
pkg.category == "games" &&
|
pkg.category == "games" &&
|
||||||
pkg.subcategory == @app_id &&
|
pkg.subcategory == @app_id &&
|
||||||
pkg.name == file.package &&
|
pkg.name.to_s.casecmp?(file.package.to_s) &&
|
||||||
pkg.version == file.version
|
pkg.version == file.version
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -295,10 +300,8 @@ class W3DHub
|
|||||||
@files.reverse.each do |file|
|
@files.reverse.each do |file|
|
||||||
break unless folder_exists
|
break unless folder_exists
|
||||||
|
|
||||||
safe_file_name = file.name.gsub("\\", "/")
|
# Normalize file paths to handle case-insensitive comparisons
|
||||||
# Fix borked Data -> data 'cause Windows don't care about capitalization
|
safe_file_name = normalize_path(file.name)
|
||||||
safe_file_name.sub!("Data/", "data/")
|
|
||||||
|
|
||||||
file_path = "#{path}/#{safe_file_name}"
|
file_path = "#{path}/#{safe_file_name}"
|
||||||
|
|
||||||
processed_files += 1
|
processed_files += 1
|
||||||
@@ -383,9 +386,9 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
package = @packages.find do |pkg|
|
package = @packages.find do |pkg|
|
||||||
pkg.category == rich.category &&
|
pkg.category.to_s.casecmp?(rich.category.to_s) &&
|
||||||
pkg.subcategory == rich.subcategory &&
|
pkg.subcategory.to_s.casecmp?(rich.subcategory.to_s) &&
|
||||||
"#{pkg.name}.zip" == rich.name &&
|
"#{pkg.name}.zip".casecmp?(rich.name) &&
|
||||||
pkg.version == rich.version
|
pkg.version == rich.version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user