Beispiel #1
0
 def validate_dir(self, path):
     if not FileUtils.exists(path):
         self.validate_output_loc(FileUtils.parent(path))
     if not FileUtils.is_dir(path):
         self.output.error(
             "{0} is a file, should be a directory".format(path))
         exit(1)
     if not FileUtils.can_write(path):
         self.output.error("Directory {0} is not writable".format(path))
         exit(1)
Beispiel #2
0
    def validate_path(self, path):
        if not FileUtils.exists(path):
            self.output.error("{0} does not exist".format(path))
            exit(1)

        if FileUtils.exists(path) and not FileUtils.is_dir(path):
            self.output.error("{0} is a file, should be a directory".format(path))
            exit(1)

        if not FileUtils.can_write(path):
            self.output.error("Directory {0} is not writable".format(path))
            exit(1)

        return True
Beispiel #3
0
    def create_dir(self, path):
        if path == '/':
            return

        if not FileUtils.exists(path):
            self.create_dir(FileUtils.parent(path))
        if not FileUtils.is_dir(path):
            self.output.error(
                "{0} is a file, should be a directory".format(path))
            exit(1)
        if not FileUtils.can_write(path):
            self.output.error("Directory {0} is not writable".format(path))
            exit(1)

        FileUtils.create_directory(path)