Initial commit: CarrotAssistant backend (Go + Gin + SQLite, OpenAI-compatible agent runtime)
This commit is contained in:
23
internal/server/paths.go
Normal file
23
internal/server/paths.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// absSkillPath joins a skill's relative file path (stored as
|
||||
// "<app_slug>/<skill_slug>.md") onto the configured skills root, yielding the
|
||||
// absolute on-disk location of the markdown file.
|
||||
func absSkillPath(skillsDir, relPath string) string {
|
||||
return filepath.Join(skillsDir, filepath.Clean("/"+relPath))
|
||||
}
|
||||
|
||||
// removeAppSkillDir deletes the per-app skill directory after an app is
|
||||
// removed. Missing directory and non-empty errors are ignored; this is
|
||||
// best-effort cleanup.
|
||||
func removeAppSkillDir(skillsDir, appSlug string) {
|
||||
if appSlug == "" {
|
||||
return
|
||||
}
|
||||
_ = os.RemoveAll(filepath.Join(skillsDir, appSlug))
|
||||
}
|
||||
Reference in New Issue
Block a user