Skip to content

Commit cb06006

Browse files
matsadlermatzbot
authored andcommitted
[rubygems/rubygems] normalise manifest path from cargo on windows
ruby/rubygems@23b5ca5fc4
1 parent c5a34f5 commit cb06006

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/rubygems/ext/cargo_builder.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def cargo_crate_name(cargo_dir, manifest_path, results)
224224
# --format-version 1 option the output is compatible with YAML, so we can
225225
# avoid the json dependency
226226
metadata = Gem::SafeYAML.safe_load(output)
227-
package = metadata["packages"].find {|pkg| pkg["manifest_path"] == manifest_path }
227+
package = metadata["packages"].find {|pkg| normalize_path(pkg["manifest_path"]) == manifest_path }
228228
unless package
229229
found = metadata["packages"].map {|md| "#{md["name"]} at #{md["manifest_path"]}" }
230230
raise Gem::InstallError, <<-EOF
@@ -239,6 +239,12 @@ def cargo_crate_name(cargo_dir, manifest_path, results)
239239
package["name"].tr("-", "_")
240240
end
241241

242+
def normalize_path(path)
243+
return path unless File::ALT_SEPARATOR
244+
245+
path.tr(File::ALT_SEPARATOR, File::SEPARATOR)
246+
end
247+
242248
def rustc_dynamic_linker_flags(dest_dir, crate_name)
243249
split_flags("DLDFLAGS")
244250
.map {|arg| maybe_resolve_ldflag_variable(arg, dest_dir, crate_name) }

0 commit comments

Comments
 (0)