From a209dccc099f41736cd46fb8b48a011bd0a9dee4 Mon Sep 17 00:00:00 2001 From: early Date: Sat, 2 Nov 2024 12:26:46 -0600 Subject: [PATCH] Move include to today --- {engine/include => include}/callstack.go | 2 +- {engine/include => include}/include.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) rename {engine/include => include}/callstack.go (97%) rename {engine/include => include}/include.go (80%) diff --git a/engine/include/callstack.go b/include/callstack.go similarity index 97% rename from engine/include/callstack.go rename to include/callstack.go index 15e4910..94f53b2 100644 --- a/engine/include/callstack.go +++ b/include/callstack.go @@ -13,7 +13,7 @@ var ErrNoRuntimeAccess = errors.New("couldn't access the runtime") var callStackNotEligible = []string{ "runtime", - "git.earlybird.gay/today-engine/include", + "git.earlybird.gay/today/include", } // SetNotEligible marks a package as ineligible for including files. diff --git a/engine/include/include.go b/include/include.go similarity index 80% rename from engine/include/include.go rename to include/include.go index c2ee4fd..800fc2c 100644 --- a/engine/include/include.go +++ b/include/include.go @@ -38,6 +38,19 @@ func (fopener *fileOpener) FileName() string { return fopener.absPath } +func Abs(filename string, ignorePackages ...string) (string, error) { + if path.IsAbs(filename) { + return filename, nil + } else { + caller, err := getCallStackButt(ignorePackages) + if err != nil { + return "", err + } else { + return path.Join(path.Dir(caller), filename), nil + } + } +} + // File returns an Opener that Opens() a file. // If filename is a relative path, it is considered relative to the *calling // file*, not the working directory. -- 2.39.5