| Module | RSCM::PathConverter |
| In: |
lib/rscm/path_converter.rb
|
# File lib/rscm/path_converter.rb, line 49
49: def ensure_trailing_slash(url)
50: return nil if url.nil?
51: if(url && url[-1..-1] != "/")
52: "#{url}/"
53: else
54: url
55: end
56: end
# File lib/rscm/path_converter.rb, line 10
10: def filepath_to_nativepath(path, escaped)
11: return nil if path.nil?
12: path = File.expand_path(path)
13: if(WIN32)
14: escaped ? path.gsub(/\//, "\\\\\\\\") : path.gsub(/\//, "\\")
15: elsif(CYGWIN)
16: cygpath = `cygpath --windows #{path}`.chomp
17: escaped ? cygpath.gsub(/\\/, "\\\\\\\\") : cygpath
18: else
19: path
20: end
21: end
# File lib/rscm/path_converter.rb, line 24
24: def filepath_to_nativeurl(path)
25: return nil if path.nil?
26: if(WINDOWS)
27: urlpath = filepath_to_nativepath(path, false).gsub(/\\/, "/")
28: "file:///#{urlpath}"
29: else
30: "file://#{File.expand_path(path)}"
31: end
32: end
# File lib/rscm/path_converter.rb, line 35
35: def nativepath_to_filepath(path)
36: return nil if path.nil?
37: path = File.expand_path(path)
38: if(WIN32)
39: path.gsub(/\//, "\\")
40: elsif(CYGWIN)
41: path = path.gsub(/\\/, "/")
42: `cygpath --unix #{path}`.chomp
43: else
44: path
45: end
46: end