From: shevegen@... Date: 2018-07-03T07:24:23+00:00 Subject: [ruby-core:87762] [Ruby trunk Bug#14891] Pathname#join has different behaviour to File.join Issue #14891 has been updated by shevegen (Robert A. Heiler). This behaviour surprised me too. Is it expected that the information from "/a" is lost? I have no idea but the documentation does not mention this; perhaps the above could be added as an example OR the behaviour changed (or both). I have little to none experience with pathname these days as I seem to handle paths ... without pathname. :D Documentation to Pathname .join is at: https://ruby-doc.org/stdlib-2.5.1/libdoc/pathname/rdoc/Pathname.html#method-i-join ---------------------------------------- Bug #14891: Pathname#join has different behaviour to File.join https://bugs.ruby-lang.org/issues/14891#change-72786 * Author: robotdana (Dana Sherson) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.6.0-preview2, and before * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ~~~ ruby Pathname.new('/a').join('/b').to_s # => "/b" File.join(Pathname.new('/a'), '/b').to_s # => "/a/b" ~~~ in my case `'/b'` was in a variable and it wasn't immediately obvious why it wasn't working when I moved to use Pathname This seems to not be desired behaviour as it's different to `File.join`, and this case isn't document anywhere. Can we either change the behaviour to treat the "other" of `Pathname#+` as always relative (possibly just removing a leading slash), or add this case to the documentation? -- https://bugs.ruby-lang.org/ Unsubscribe: