diff --git a/apio/profile.py b/apio/profile.py index 464b1db6..e1d59570 100644 --- a/apio/profile.py +++ b/apio/profile.py @@ -199,9 +199,12 @@ def _load_profile(self, profile: Path): self.packages = data # Backward compatibility def save(self): - """DOC: todo""" + """Save the profile file""" - util.mkdir(self._profile_path) + # -- Create the profile folder, if it does not exist yet + path = self._profile_path.parent + if not path.exists(): + path.mkdir() with open(self._profile_path, "w", encoding="utf8") as profile: data = { diff --git a/apio/util.py b/apio/util.py index 3d5fed71..9efad500 100644 --- a/apio/util.py +++ b/apio/util.py @@ -628,21 +628,6 @@ def print_exception_developers(e): click.secho(f"{e}\n", fg="yellow") -def mkdir(path): - """DOC: TODO""" - - # path = dirname(path) - path = path.parent - - if not path.exists(): - path.mkdir() - # if not exists(path): - # try: - # os.makedirs(path) - # except OSError: - # pass - - def check_dir(_dir: Path) -> Path: """Check if the given path is a folder. It it does not exists the folder is created. If no path is given the current working