Sha256: 3db3c823d8a5a9340ea3819f0a4c4715211e482b987461a209e9adc9dc9a39d5

Contents?: true

Size: 405 Bytes

Versions: 51

Compression:

Stored size: 405 Bytes

Contents

# encoding: utf-8

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

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.131 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.130 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.129 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.128 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.127 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.126 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.125 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.124 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.123 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.122 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.121 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.120 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.119 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.118 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.117 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.116 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.115 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.114 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.113 lib/open_classes/string/winpath_to_cygwinpath.rb
tbpgr_utils-0.0.112 lib/open_classes/string/winpath_to_cygwinpath.rb