| author | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-11-28 00:14:25 UTC |
| committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-11-28 00:20:10 UTC |
| parent | 957aa424e4fb3b897c60547db422bbce5f6c24b0 |
| git-arr | +5 | -3 |
diff --git a/git-arr b/git-arr index adb784f..add0d1b 100755 --- a/git-arr +++ b/git-arr @@ -366,8 +366,10 @@ def generate(output: str, only=None): if mtime: path_mtime: Union[float, int] = 0 - if os.path.exists(path): + try: path_mtime = os.stat(path).st_mtime + except FileNotFoundError: + pass # Make sure they're both float or int, to avoid failing # comparisons later on because of this. @@ -395,8 +397,8 @@ def generate(output: str, only=None): s = func_or_str(*args) dirname = os.path.dirname(path) - if not os.path.exists(dirname): - os.makedirs(dirname) + if dirname: + os.makedirs(dirname, exist_ok=True) open(path, "w").write(s) if mtime: