Skip to content

Commit ee9ee52

Browse files
committed
macos: Fix vfs bug. PR AeonLucid#63
1 parent dbced03 commit ee9ee52

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/androidemu/vfs/file_system.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ def translate_path(self, filename) -> pathlib.Path:
5555

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

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

0 commit comments

Comments
 (0)