1 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
14 s = @path.gsub(/([\/%]+)/n){
15 "%" + $1.unpack("H2" * $1.size).join("%").upcase
21 # s = self.basename.to_s.gsub(/([\/%<>*?]+)/n){
22 s = self.basename.to_s.gsub(/([\/<>*?]+)/n){
23 "%" + $1.unpack("H2" * $1.size).join("%").upcase
25 Pathname.new(self.dirname+s)
28 def unescape # copied from cgi.rb
29 s = @path.tr("+", " ").gsub(/((?:%[0-9a-fA-F]{2})+)/n) {
30 [$1.delete("%")].pack("H*")
35 # translate file name for deal with the restriction of Windows file system.
37 win = @path.gsub(/</, "(")
38 win = win.gsub(/>/, ")")
39 win = win.gsub(/\*/, "+")
40 win = win.gsub(/\?/, "!")
45 unix = @path.gsub(/\)/, ">")
46 unix = unix.gsub(/\(/, "<")
47 unix = unix.gsub(/\!/, "?")
48 unix = unix.gsub(/\+/, "*")
52 def escape_win_filename
53 return self.unix_to_win if CHISE.windows?
57 def unescape_win_filename
58 return self.win_to_unix if CHISE.windows?