lib/rscm/path_converter.rb in rscm-0.3.16 vs lib/rscm/path_converter.rb in rscm-0.4.0
- old
+ new
@@ -2,25 +2,10 @@
CYGWIN = RUBY_PLATFORM == "i386-cygwin"
WINDOWS = WIN32 || CYGWIN
require 'fileutils'
-def with_working_dir(dir)
- # Can't use Dir.chdir{ block } - will fail with multithreaded code.
- # http://www.ruby-doc.org/core/classes/Dir.html#M000790
- #
- prev = Dir.pwd
- begin
- dir = File.expand_path(dir)
- FileUtils.mkdir_p(dir)
- Dir.chdir(dir)
- yield
- ensure
- Dir.chdir(prev)
- end
-end
-
# Utility for converting between win32 and cygwin paths. Does nothing on *nix.
module RSCM
module PathConverter
def filepath_to_nativepath(path, escaped)
return nil if path.nil?
@@ -48,9 +33,10 @@
end
end
def nativepath_to_filepath(path)
return nil if path.nil?
+ path = File.expand_path(path)
if(WIN32)
path.gsub(/\//, "\\")
elsif(CYGWIN)
path = path.gsub(/\\/, "/")
cmd = "cygpath --unix #{path}"