Sha256: 4141e5345dc0401995fbcc9ccf60f11a337a6c4009cb6a5211e56ea96435469a

Contents?: true

Size: 422 Bytes

Versions: 49

Compression:

Stored size: 422 Bytes

Contents

# encoding: utf-8

class String
  # convert windows path to cygwin path
  #
  # ==== Examples
  #
  #   '/cygdrive/c/hoge/hoge.txt'.cygwinpath_to_winpath # => 'C:\hoge\hoge.txt'
  #
  def cygwinpath_to_winpath
    return self unless match(%r{/cygdrive/})
    drive = scan(%r{/cygdrive/(\w)/}).first.first.upcase
    dir_file = scan(%r{/cygdrive/\w/(.*)}).first.first.gsub('/', '\\')
    "#{drive}:\\#{dir_file}"
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.150 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.149 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.148 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.147 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.146 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.145 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.144 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.143 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.142 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.141 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.140 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.139 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.138 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.137 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.136 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.135 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.134 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.133 lib/open_classes/string/cygwinpath_to_winpath.rb
tbpgr_utils-0.0.132 lib/open_classes/string/cygwinpath_to_winpath.rb