MCPcopy Create free account
hub / github.com/SolarLune/masterplan / LocalRelativePath

Function LocalRelativePath

utils.go:75–94  ·  view source on GitHub ↗

import ( "math" "os" "path/filepath" "sort" "strconv" "strings" "time" rl "github.com/gen2brain/raylib-go/raylib" ) We have a global mouse offset specifically for panels that render GUI elements to a texture and then draw the texture elsewhere. var globalMouseOffset = rl.Vector2{} func GetMo

(localPath string)

Source from the content-addressed store, hash-verified

73// }
74
75func LocalRelativePath(localPath string) string {
76
77 // Running apps from Finder in MacOS makes the working directory the home directory, which is nice, because
78 // now I have to make this function to do what should be done anyway and give me a relative path starting from
79 // the executable so that I can load assets from the assets directory. :,)
80
81 exePath, _ := os.Executable()
82
83 workingDirectory := filepath.Dir(exePath)
84
85 if globals.ReleaseMode == ReleaseModeDev {
86 // Not in release mode, so current working directory is the root.
87 workingDirectory, _ = os.Getwd()
88 }
89
90 out := filepath.Join(workingDirectory, filepath.FromSlash(localPath))
91
92 return out
93
94}
95
96type Vector struct {
97 X, Y float32

Callers 11

TakeScreenshotFunction · 0.85
initFunction · 0.85
CreateGridTextureMethod · 0.85
DrawGridMethod · 0.85
HandleFontReloadFunction · 0.85
loadThemesFunction · 0.85
NewImageContentsFunction · 0.85
UpdateMethod · 0.85
LoadCursorsFunction · 0.85
mainFunction · 0.85
ConstructMenusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected