Browse Source

Set dev root

Cody Joyce 1 month ago
parent
commit
45cf25a061
1 changed files with 4 additions and 8 deletions
  1. 4 8
      utils/utils.go

+ 4 - 8
utils/utils.go

@@ -8,7 +8,6 @@ import (
 	"log"
 	"math/rand"
 	"os"
-	"path"
 	"runtime"
 	"strconv"
 	"strings"
@@ -17,13 +16,8 @@ import (
 
 var root string
 
-func SetRoot() {
-	if strings.HasPrefix(os.Args[0], os.TempDir()) {
-		root = Cwd(2) + "/"
-	} else {
-		f, _ := os.Executable()
-		root = path.Dir(f) + "/"
-	}
+func SetDevRoot(path string) {
+	root = path + "/"
 }
 
 func Cwd(i int) string {
@@ -32,6 +26,8 @@ func Cwd(i int) string {
 	slice = slice[:len(slice)-1]
 	path := strings.Join(slice, "/")
 	path = strings.Replace(path, root, "", 1)
+	fmt.Println("root", root)
+	fmt.Println("path", path)
 	return path
 }