Example #1
0
 def cwd(self, dir_name):
     path = normpath_url(join_url(self.cur_dir, dir_name))
     if not path.startswith(self.root_dir):
         raise RuntimeError("Tried to navigate outside root %r: %r" % (self.root_dir, path))
     self.cur_dir_meta = None
     self.cur_dir = path
     return self.cur_dir
Example #2
0
 def cwd(self, dir_name):
     path = normpath_url(join_url(self.cur_dir, dir_name))
     if not path.startswith(self.root_dir):
         raise RuntimeError("Tried to navigate outside root %r: %r" % (self.root_dir, path))
     self.cur_dir_meta = None
     self.cur_dir = path
     return self.cur_dir
Example #3
0
 def cwd(self, dir_name):
     path = normpath_url(join_url(self.cur_dir, dir_name))
     if not path.startswith(self.root_dir):
         # paranoic check to prevent that our sync tool goes berserk
         raise RuntimeError("Tried to navigate outside root %r: %r" %
                            (self.root_dir, path))
     self.ftp.cwd(dir_name)
     self.cur_dir = path
     self.cur_dir_meta = None
     return self.cur_dir
Example #4
0
 def cwd(self, dir_name):
     path = normpath_url(join_url(self.cur_dir, dir_name))
     if not path.startswith(self.root_dir):
         # paranoic check to prevent that our sync tool goes berserk
         raise RuntimeError("Tried to navigate outside root %r: %r"
                            % (self.root_dir, path))
     self.ftp.cwd(dir_name)
     self.cur_dir = path
     self.cur_dir_meta = None
     return self.cur_dir
Example #5
0
 def rmdir(self, dir_name):
     """Remove cur_dir/name."""
     self.check_write(dir_name)
     path = normpath_url(join_url(self.cur_dir, dir_name))
     #         print("REMOVE %r" % path)
     shutil.rmtree(path)
Example #6
0
 def mkdir(self, dir_name):
     self.check_write(dir_name)
     path = normpath_url(join_url(self.cur_dir, dir_name))
     os.mkdir(path)
Example #7
0
 def get_rel_path(self):
     path = relpath_url(self.target.cur_dir, self.target.root_dir)
     return normpath_url(join_url(path, self.name))
Example #8
0
    def rmdir(self, dir_name):
        """Remove cur_dir/name."""
        self.check_write(dir_name)
        path = normpath_url(join_url(self.cur_dir, dir_name))
#         print("REMOVE %r" % path)
        shutil.rmtree(path)
Example #9
0
 def mkdir(self, dir_name):
     self.check_write(dir_name)
     path = normpath_url(join_url(self.cur_dir, dir_name))
     os.mkdir(path)