Sha256: 73b8658b4ef82205d6a3fecf4e234d3c23932c2b30cae7c4dd8e2d21ecbfd771
Contents?: true
Size: 819 Bytes
Versions: 13
Compression:
Stored size: 819 Bytes
Contents
module Berkshelf::Mixin # @author Jamie Winsor <reset@riotgames.com> module PathHelpers # Converts a path to a path usable for your current platform # # @param [String] path # # @return [String] def platform_specific_path(path) if RUBY_PLATFORM =~ /mswin|mingw|windows/ system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : "" path = win_slashify File.join(system_drive, path.split('/')[2..-1]) end path end # Convert a unixy filepath to a windowsy filepath. Swaps forward slashes for # double backslashes # # @param [String] path # filepath to convert # # @return [String] # converted filepath def win_slashify(path) path.gsub(File::SEPARATOR, (File::ALT_SEPARATOR || '\\')) end end end
Version data entries
13 entries across 13 versions & 1 rubygems