Files

RSCM::PathConverter

Public Class Methods

ensure_trailing_slash(url) click to toggle source
# File lib/rscm/path_converter.rb, line 49
def ensure_trailing_slash(url)
  return nil if url.nil?
  if(url && url[-1..-1] != "/")
    "#{url}/"
  else
    url
  end
end
filepath_to_nativepath(path, escaped) click to toggle source
# File lib/rscm/path_converter.rb, line 10
def filepath_to_nativepath(path, escaped)
  return nil if path.nil?
  path = File.expand_path(path)
  if(WIN32)
    escaped ? path.gsub(/\//, "\\\\\\\\") : path.gsub(/\//, "\\")
  elsif(CYGWIN)
    cygpath = `cygpath --windows #{path}`.chomp
    escaped ? cygpath.gsub(/\\/, "\\\\\\\\") : cygpath
  else
    path
  end
end
filepath_to_nativeurl(path) click to toggle source
# File lib/rscm/path_converter.rb, line 24
def filepath_to_nativeurl(path)
  return nil if path.nil?
  if(WINDOWS)
    urlpath = filepath_to_nativepath(path, false).gsub(/\\/, "/")
    "file:///#{urlpath}"
  else
    "file://#{File.expand_path(path)}"
  end
end
nativepath_to_filepath(path) click to toggle source
# File lib/rscm/path_converter.rb, line 35
def nativepath_to_filepath(path)
  return nil if path.nil?
  path = File.expand_path(path)
  if(WIN32)
    path.gsub(/\//, "\\")
  elsif(CYGWIN)
    path = path.gsub(/\\/, "/")
    `cygpath --unix #{path}`.chomp
  else
    path
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.