fix: handle os.Getwd error in evolution skills_recall and drafts
When os.Getwd fails, wd is empty and builtinSkillsDir resolves to relative path, causing confusing downstream errors. Fall back to config.GetHome on error.
This commit is contained in:
1 parent
10115f941c
commit
cbb684be01
2 files changed
+8
-2
No files matched your search
@@ -67,7 +67,10 @@ type DefaultDraftGenerator struct {
|
||||
func NewDefaultDraftGenerator(workspace string) *DefaultDraftGenerator {
|
||||
builtinSkillsDir := strings.TrimSpace(os.Getenv(config.EnvBuiltinSkills))
|
||||
if builtinSkillsDir == "" {
|
||||
wd, _ := os.Getwd()
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
wd = config.GetHome()
|
||||
}
|
||||
builtinSkillsDir = filepath.Join(wd, "skills")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user