2 # -*- coding: utf-8 -*-
6 def initialize(basepath)
8 @basepath << "/" unless @basepath[-1] == "/"
11 raise "Target dir not found." unless check_dir_exist(pwd)
15 filelist = Dir::entries(pwd)
24 @relpath_list.delete_at(-1) unless @relpath_list.length == 0
25 elsif pathname.match(/([^\w]|\.\.)/) == nil
26 if check_dir_exist(pwd + "/" + pathname)
27 @relpath_list << pathname
29 raise "Target dir not found."
39 if @relpath_list.length == 0
42 @relpath_list.join("/") << "/"
46 def upload(file, fname)
47 if File.exist?(pwd + fname)
48 raise "Target file exist."
50 open(pwd + File.basename(fname), "w") do |f|
58 if File.exist?(pwd + fname)
59 File.delete(pwd + fname)
61 raise "Target file is not exist."
66 unless (File.exist? dirname)
67 raise "Target directory is exist."
74 if (File.exist? dirname)
75 raise "Target directory is not exist."
81 def check_dir_exist(target_dir)
82 unless (File.exist? target_dir || File.ftype(target_dir) != "directory")
91 filer = WebFiler.new("C:/workspace/aptana")
104 ferror = WebFiler.new("C:/NotMatched")