Blame 0001-Use-system-path-for-TINYGOROOT-default.patch

421b6c
From e2bff2b9ed327434762915429e9033e81815b3ac Mon Sep 17 00:00:00 2001
b34ba9
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
b34ba9
Date: Fri, 7 Jun 2019 20:53:54 -0400
b34ba9
Subject: [PATCH 1/4] Use system path for TINYGOROOT default.
b34ba9
b34ba9
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
b34ba9
---
b34ba9
 target.go | 17 ++---------------
b34ba9
 1 file changed, 2 insertions(+), 15 deletions(-)
b34ba9
b34ba9
diff --git a/target.go b/target.go
421b6c
index 679fa19..fc4589b 100644
b34ba9
--- a/target.go
b34ba9
+++ b/target.go
421b6c
@@ -267,21 +267,8 @@ func sourceDir() string {
b34ba9
 		return root
b34ba9
 	}
b34ba9
 
b34ba9
-	// Find root from executable path.
b34ba9
-	path, err := os.Executable()
b34ba9
-	if err != nil {
b34ba9
-		// Very unlikely. Bail out if it happens.
b34ba9
-		panic("could not get executable path: " + err.Error())
b34ba9
-	}
b34ba9
-	root = filepath.Dir(filepath.Dir(path))
b34ba9
-	if isSourceDir(root) {
b34ba9
-		return root
b34ba9
-	}
b34ba9
-
b34ba9
-	// Fallback: use the original directory from where it was built
b34ba9
-	// https://stackoverflow.com/a/32163888/559350
b34ba9
-	_, path, _, _ = runtime.Caller(0)
b34ba9
-	root = filepath.Dir(path)
b34ba9
+	// Use system directory
b34ba9
+	root = "/usr/share/tinygo"
b34ba9
 	if isSourceDir(root) {
b34ba9
 		return root
b34ba9
 	}
b34ba9
-- 
b34ba9
2.21.0
b34ba9