diff --git a/bin/ocran b/bin/ocran index dd2374d..b6f53f1 100644 --- a/bin/ocran +++ b/bin/ocran @@ -86,6 +86,18 @@ module Ocran src_normalized =~ /^#{Regexp.escape tgt_normalized}#{Pathname::SEPARATOR_PAT}/i end + # Join two pathnames together. Returns the right-hand side if it + # is an absolute path. Otherwise, returns the full path of the + # left + right. + def /(other) + other = Pathname === other ? other : Pathname.new(other) + if other.absolute? + other + else + Pathname.new(plus(@path, other.to_s)) + end + end + # Appends the given suffix to the filename, preserving the file extension. # If the filename has an extension, the suffix is inserted before the extension. # If the filename does not have an extension, the suffix is appended to the end.