diff options
Diffstat (limited to 'android/sandbox.go')
-rw-r--r-- | android/sandbox.go | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/android/sandbox.go b/android/sandbox.go index ed022fb87..28e903ad4 100644 --- a/android/sandbox.go +++ b/android/sandbox.go @@ -14,29 +14,8 @@ package android -import ( - "fmt" - "os" -) - -func init() { - // Stash the working directory in a private variable and then change the working directory - // to "/", which will prevent untracked accesses to files by Go Soong plugins. The - // SOONG_SANDBOX_SOONG_BUILD environment variable is set by soong_ui, and is not - // overrideable on the command line. - - orig, err := os.Getwd() - if err != nil { - panic(fmt.Errorf("failed to get working directory: %s", err)) - } - absSrcDir = orig - - if getenv("SOONG_SANDBOX_SOONG_BUILD") == "true" { - err = os.Chdir("/") - if err != nil { - panic(fmt.Errorf("failed to change working directory to '/': %s", err)) - } - } +func InitSandbox(topDir string) { + absSrcDir = topDir } // DO NOT USE THIS FUNCTION IN NEW CODE. |