diff --git a/openage/util/fslike/path.py b/openage/util/fslike/path.py index c34a5d6a6c..422b9f176b 100644 --- a/openage/util/fslike/path.py +++ b/openage/util/fslike/path.py @@ -149,6 +149,10 @@ def open_w(self): """ open with mode='wb' """ return self.fsobj.open_w(self.parts) + def open_a(self): + """ open with mode='ab' """ + return self.fsobj.open_a(self.parts) + def _get_native_path(self): """ return the native path (usable by your kernel) of this path, diff --git a/openage/util/fslike/union.py b/openage/util/fslike/union.py index eb28129d01..7b2ca8a8f2 100644 --- a/openage/util/fslike/union.py +++ b/openage/util/fslike/union.py @@ -116,6 +116,14 @@ def open_w(self, parts): raise UnsupportedOperation( "not writable: " + b'/'.join(parts).decode(errors='replace')) + def open_a(self, parts): + for path in self.candidate_paths(parts): + if path.writable(): + return path.open_a() + + raise UnsupportedOperation( + "not appendable: " + b'/'.join(parts).decode(errors='replace')) + def resolve_r(self, parts): for path in self.candidate_paths(parts): if path.is_file() or path.is_dir():