mirror of
https://github.com/charmbracelet/crush.git
synced 2025-08-02 05:20:46 +03:00
chore: fix homedir
This commit is contained in:
@@ -156,7 +156,7 @@ func ListDirectory(initialPath string, ignorePatterns []string, limit int) ([]st
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
if err != nil && len(results) == 0 {
|
||||
return nil, truncated, err
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,14 @@ func (l *lsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
|
||||
searchPath = l.workingDir
|
||||
}
|
||||
|
||||
if searchPath == "~" {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ToolResponse{}, fmt.Errorf("error resolving home directory: %w", err)
|
||||
}
|
||||
searchPath = homeDir
|
||||
}
|
||||
|
||||
if !filepath.IsAbs(searchPath) {
|
||||
searchPath = filepath.Join(l.workingDir, searchPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user