Module RSCM::PathConverter
In: lib/rscm/path_converter.rb

Methods

Public Instance methods

[Source]

    # File lib/rscm/path_converter.rb, line 66
66:     def ensure_trailing_slash(url)
67:       return nil if url.nil?
68:       if(url && url[-1..-1] != "/")
69:         "#{url}/"
70:       else
71:         url
72:       end
73:     end

[Source]

    # File lib/rscm/path_converter.rb, line 25
25:     def filepath_to_nativepath(path, escaped)
26:       return nil if path.nil?
27:       path = File.expand_path(path)
28:       if(WIN32)
29:         path.gsub(/\//, "\\")
30:       elsif(CYGWIN)
31:         cmd = "cygpath --windows #{path}"
32:         Better.popen(cmd) do |io|
33:           cygpath = io.read.chomp
34:           escaped ? cygpath.gsub(/\\/, "\\\\\\\\") : cygpath
35:         end
36:       else
37:         path
38:       end
39:     end

[Source]

    # File lib/rscm/path_converter.rb, line 41
41:     def filepath_to_nativeurl(path)
42:       return nil if path.nil?
43:       if(WINDOWS)
44:         urlpath = filepath_to_nativepath(path, false).gsub(/\\/, "/")
45:         "file:///#{urlpath}"
46:       else
47:         "file://#{File.expand_path(path)}"
48:       end
49:     end

[Source]

    # File lib/rscm/path_converter.rb, line 51
51:     def nativepath_to_filepath(path)
52:       return nil if path.nil?
53:       if(WIN32)
54:         path.gsub(/\//, "\\")
55:       elsif(CYGWIN)
56:         path = path.gsub(/\\/, "/")
57:         cmd = "cygpath --unix #{path}"
58:         Better.popen(cmd) do |io|
59:           io.read.chomp
60:         end
61:       else
62:         path
63:       end
64:     end

[Validate]