# ap-list:2414
# patch for Win NT4
old = $:.dup
$:.collect!{|s| s.tr('/','\\')}
require 'phi.so'
$:.replace old

# [ap-dev:0798]
Win = Sys = Phi unless defined? Win

# ap-dev:0844
class Float
  alias _to_s to_s
  def to_s
    Phi.FInit
    _to_s
  end
end

class Struct
  class SearchRec
    def read_only? ; (self.attr & Phi::FA_READ_ONLY) != 0 ; end
    def hidden?    ; (self.attr & Phi::FA_HIDDEN)    != 0 ; end
    def sys_file?  ; (self.attr & Phi::FA_SYS_FILE)  != 0 ; end
    def volume_id? ; (self.attr & Phi::FA_VOLUME_ID) != 0 ; end
    def directory? ; (self.attr & Phi::FA_DIRECTORY) != 0 ; end
    def archive?   ; (self.attr & Phi::FA_ARCHIVE)   != 0 ; end
    def file?
        (self.attr & (Phi::FA_VOLUME_ID | Phi::FA_DIRECTORY)) == 0
    end
    def to_s
      a = (archive?   ? 'A' : '-')+
          (directory? ? 'D' : '-')+
          (volume_id? ? 'V' : '-')+
          (sys_file?  ? 'S' : '-')+
          (hidden?    ? 'H' : '-')+
          (read_only? ? 'R' : '-')
      "%-20s %-20s %10d %s %2d" % [self.name,self.time,self.size,a,self.attr]
    end
    alias mtime time
  end
end
