Class: FileIO
- Inherits:
-
Object
- Object
- FileIO
- Defined in:
- lib/file_io.rb
Class Method Summary collapse
-
.encodePath(path) ⇒ Object
ファイルオープン時、パス文字列のエンコードを変換してシステムに返却するためのメソッド.
- .filesystem ⇒ Object
Class Method Details
.encodePath(path) ⇒ Object
ファイルオープン時、パス文字列のエンコードを変換してシステムに返却するためのメソッド
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/file_io.rb', line 4 def self.encodePath(path) case self.filesystem when 'u' #utf8=>utf8なので何もしない #path = MyMatrix.toutf8(path) #path.encode('UTF-8') path when 's' path = MyMatrix.tosjis(path) #path.encode('Windows-31J') when 'w' path = MyMatrix.tosjis(path) #path.encode('Windows-31J') when 'm' path = MyMatrix.toUtf8Mac(path) end end |
.filesystem ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/file_io.rb', line 21 def self.filesystem #platform check if(RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|cygwin|bccwin/) filesystem = 's' elsif(RUBY_PLATFORM.downcase =~ /darwin/) filesystem = 'm' elsif(RUBY_PLATFORM.downcase =~ /linux/) filesystem = 'u' else filesystem = 'u' end return filesystem end |