def _process_directory(directory): """Assign directory if none was given, and create directory if necessary.""" directory = Util.expand(directory) if directory is None: LOG.debug("No directory provided, defaulting to %s.", directory) return Util.expand(CONSTANTS.APPDIRS.user_data_dir) LOG.debug("Provided directory %s.", directory) Util.ensure_dir(directory) return directory
def _process_directory(directory): """Assign directory if none was given, and create directory if necessary.""" directory = Util.expand(directory) if directory is None: LOG.debug("No directory provided, defaulting to %s.", directory) return Util.expand(CONSTANTS.APPDIRS.user_data_dir) LOG.debug("Provided directory %s.", directory) if not os.path.isdir(directory): LOG.debug("Directory %s does not exist, creating it.", directory) os.makedirs(directory) return directory
def update(self, directory=None, config_dir=None, url=None, set_original=False, name=None): """Update values for this subscription.""" if directory == "": raise ERROR.InvalidConfigError(desc=textwrap.dedent( """\ Provided invalid sub directory '{}' for '{}'.\ """.format(directory, self.name))) if directory is not None: directory = Util.expand(directory) if self.directory != directory: if os.path.isabs(directory): self.directory = directory else: self.directory = os.path.join(config_dir, directory) if not os.path.isdir(self.directory): LOG.debug("Directory %s does not exist, creating it.", directory) os.makedirs(self.directory) if url is not None: self.url = url if set_original: self.original_url = url if name is not None: self.name = name
def update(self, directory=None, config_dir=None, url=None, set_original=False, name=None): """Update values for this subscription.""" if directory == "": LOG.debug("Provided invalid sub directory '%s' for '%s'- ignoring update.", directory, self.name) return if directory is not None: directory = Util.expand(directory) if self.directory != directory: if os.path.isabs(directory): self.directory = directory else: self.directory = os.path.join(config_dir, directory) Util.ensure_dir(self.directory) if url is not None: self.url = url if set_original: self.original_url = url if name is not None: self.name = name