Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435package global
import ( "fmt" "os" "path/filepath")
// findLibrary tries to go up each directory from the working directory and check for the existence of a "lib" directory.// This is needed for tests to work correctly.func findLibrary() { dir, err := os.Getwd()
if err != nil { panic(err) }
for { Library = filepath.Join(dir, "lib") stat, err := os.Stat(Library)
if err == nil && stat.IsDir() { return }
newDir := filepath.Dir(dir)
if newDir == dir { fmt.Fprintln(os.Stderr, "standard library not found") os.Exit(1) }
dir = newDir }}