Blob Blame History Raw
From 812286161dae5d09d4c2e1e30d334abbe67dac6c Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 7 Jun 2019 20:53:54 -0400
Subject: [PATCH 1/4] Use system path for TINYGOROOT default.

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 target.go | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/target.go b/target.go
index c389b65..c03edfb 100644
--- a/target.go
+++ b/target.go
@@ -258,21 +258,8 @@ func sourceDir() string {
 		return root
 	}
 
-	// Find root from executable path.
-	path, err := os.Executable()
-	if err != nil {
-		// Very unlikely. Bail out if it happens.
-		panic("could not get executable path: " + err.Error())
-	}
-	root = filepath.Dir(filepath.Dir(path))
-	if isSourceDir(root) {
-		return root
-	}
-
-	// Fallback: use the original directory from where it was built
-	// https://stackoverflow.com/a/32163888/559350
-	_, path, _, _ = runtime.Caller(0)
-	root = filepath.Dir(path)
+	// Use system directory
+	root = "/usr/share/tinygo"
 	if isSourceDir(root) {
 		return root
 	}
-- 
2.21.0