mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Fixed edge case where Task#normalize_path wouldn't handle partial matches of correctly
This commit is contained in:
@@ -118,12 +118,14 @@ class W3DHub
|
|||||||
|
|
||||||
constructed_path = base_path
|
constructed_path = base_path
|
||||||
|
|
||||||
|
accepted_parts = 0
|
||||||
split_path = path.split("/")
|
split_path = path.split("/")
|
||||||
split_path.each do |segment|
|
split_path.each do |segment|
|
||||||
Dir.glob("#{constructed_path}/*").each do |part|
|
Dir.glob("#{constructed_path}/*").each do |part|
|
||||||
next unless "#{constructed_path}/#{segment}".downcase == part.downcase
|
next unless "#{constructed_path}/#{segment}".downcase == part.downcase
|
||||||
|
|
||||||
constructed_path = part
|
constructed_path = part
|
||||||
|
accepted_parts += 1
|
||||||
|
|
||||||
break if File.file?(constructed_path)
|
break if File.file?(constructed_path)
|
||||||
end
|
end
|
||||||
@@ -132,6 +134,8 @@ class W3DHub
|
|||||||
# Find file if it exists else use provided path as cased
|
# Find file if it exists else use provided path as cased
|
||||||
if "#{base_path}/#{path}".length == constructed_path.length
|
if "#{base_path}/#{path}".length == constructed_path.length
|
||||||
constructed_path
|
constructed_path
|
||||||
|
elsif accepted_parts.positive?
|
||||||
|
"#{constructed_path}/#{split_path[accepted_parts..].join('/')}"
|
||||||
else
|
else
|
||||||
"#{base_path}/#{path}" # File doesn't exist, case doesn't matter.
|
"#{base_path}/#{path}" # File doesn't exist, case doesn't matter.
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user