Skip to content

Commit

Permalink
macos: Fix vfs bug. PR AeonLucid#63
Browse files Browse the repository at this point in the history
  • Loading branch information
enovella committed Nov 6, 2022
1 parent dbced03 commit ee9ee52
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/androidemu/vfs/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ def translate_path(self, filename) -> pathlib.Path:

file_path = self._root_path.joinpath(filename).resolve()

# is_relative_to is new in version 3.9
if not hasattr(file_path, 'is_relative_to'):
# when system is macos, the pathlib.Path return was PosixPath, The PosixPath object does not have the is_relative_to method
if os.name == "posix":
try:
file_path.relative_to(self._root_path)
except:
# if file_path is not in the subpath of self._root_path, ValueError is raised
raise RuntimeError("Emulator tried to read outside vfs ('%s' not in '%s')." % (file_path, self._root_path))
else:
if not file_path.is_relative_to(self._root_path):
Expand Down

0 comments on commit ee9ee52

Please sign in to comment.