Skip to content

Commit

Permalink
Merge pull request #1595 from heinezen/fix/append_mode
Browse files Browse the repository at this point in the history
Fix append mode not available
  • Loading branch information
TheJJ committed Nov 2, 2023
2 parents 655bba2 + fdba308 commit 45d00d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openage/util/fslike/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions openage/util/fslike/union.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 45d00d2

Please sign in to comment.