Skip to content
Snippets Groups Projects
Commit 84c32d83 authored by Jim MacArthur's avatar Jim MacArthur
Browse files

Convert uses of external_directory to get_underlying_directory()

parent b030c005
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,10 @@ from .._fuse import SafeHardlinks
class Mount():
def __init__(self, sandbox, mount_point, safe_hardlinks):
scratch_directory = sandbox._get_scratch_directory()
# Getting external_directory here is acceptable as we're part of the sandbox code.
root_directory = sandbox.get_virtual_directory().external_directory
# Getting get_underlying_directory() here is acceptable as
# we're part of the sandbox code. This will fail if our
# directory is CAS-based.
root_directory = sandbox.get_virtual_directory().get_underlying_directory()
self.mount_point = mount_point
self.safe_hardlinks = safe_hardlinks
......
......@@ -58,7 +58,7 @@ class SandboxBwrap(Sandbox):
stdout, stderr = self._get_output()
# Allowable access to underlying storage as we're part of the sandbox
root_directory = self.get_virtual_directory().external_directory
root_directory = self.get_virtual_directory().get_underlying_directory()
# Fallback to the sandbox default settings for
# the cwd and env.
......
......@@ -214,3 +214,8 @@ class FileBasedDirectory(Directory):
# which exposes the sandbox directory; we will have to assume for the time being
# that people will not abuse __str__.
return self.external_directory
def get_underlying_directory(self) -> str:
""" Returns the underlying (real) file system directory this
object refers to. """
return self.external_directory
......@@ -153,3 +153,9 @@ class Directory():
"""
raise NotImplementedError()
def get_underlying_directory(self) -> str:
""" Returns the underlying (real) file system directory this
object refers to. This will throw an exception if there isn't
a real directory behind the object. """
raise NotImplementedError()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment