Module: FileSystem

Defined in:
lib/atk/info.rb

Overview

duplicated for the sake of efficieny (so that the parser doesn’t need to import all of FileSystem)

Class Method Summary collapse

Class Method Details

.join(*args) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/atk/info.rb', line 19

def self.join(*args)
    if OS.is?("windows")
        folders_without_leading_or_trailing_slashes = args.map do |each|
            # replace all forward slashes with backslashes
            backslashed_only = each.gsub(/\//,"\\")
            # remove leading/trailing backslashes
            backslashed_only.gsub(/(^\\|^\/|\\$|\/$)/,"")
        end
        # join all of them with backslashes
        folders_without_leading_or_trailing_slashes.join("\\")
    else
        File.join(*args)
    end
end