1 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
13 def escape # copied from cgi.rb
14 s = @path.gsub(/([\/%]+)/n){
15 "%" + $1.unpack("H2" * $1.size).join("%").upcase
20 def unescape # copied from cgi.rb
21 s = @path.tr("+", " ").gsub(/((?:%[0-9a-fA-F]{2})+)/n) {
22 [$1.delete("%")].pack("H*")
27 # translate file name for deal with the restriction of Windows file system.
29 win = @path.gsub(/</, "(")
30 win = win.gsub(/>/, ")")
31 win = win.gsub(/\*/, "+")
32 win = win.gsub(/\?/, "!")
37 unix = @path.gsub(/\)/, ">")
38 unix = unix.gsub(/\(/, "<")
39 unix = unix.gsub(/\!/, "?")
40 unix = unix.gsub(/\+/, "*")
44 def escape_win_filename
45 return self.unix_to_win if CHISE.windows?
49 def unescape_win_filename
50 return self.win_to_unix if CHISE.windows?