Beispiel #1
0
 def rand_dir_path_by_depth(parent, depth, left=3, right=15):
     dir_path = parent
     for i in range(depth):
         while (True):
             f = os.path.join(dir_path, JWords.hump(left, right))
             if not os.path.exists(f):  # 避免覆盖
                 dir_path = f
                 break
     if (not os.path.exists(dir_path)):
         JFileUtils.mkdir(dir_path)
     return dir_path
Beispiel #2
0
    def _prepare(self):
        JFileUtils.rmdir(self._source_dir)

        mix_dirs = []
        for i in range(random.randint(1, 21)):
            d = os.path.join(self._source_dir, JOcHelper.var(self._mix_dirs))
            JFileUtils.mkdir(d)
            mix_dirs.append(d)
        self._mix_dirs = mix_dirs

        refs_dir = os.path.join(self._source_dir, JOcHelper.var())
        JFileUtils.mkdir(refs_dir)
        self._refs_dir = refs_dir
Beispiel #3
0
 def _prepare(self):
     JFileUtils.rmdir(self._dst_dir)
     JFileUtils.mkdir(self._dst_dir)