| 176 | } |
| 177 | |
| 178 | func (sd *ScriptDrive) List(ctx context.Context, path string) ([]types.IEntry, error) { |
| 179 | vm, e := sd.pool.Get(ctx) |
| 180 | if e != nil { |
| 181 | return nil, e |
| 182 | } |
| 183 | defer func() { _ = sd.pool.Return(context.Background(), vm) }() |
| 184 | v, e := sd.call(ctx, vm, "list", s.NewContext(vm, ctx), path) |
| 185 | if e != nil { |
| 186 | return nil, e |
| 187 | } |
| 188 | arr := v.Array() |
| 189 | if arr == nil { |
| 190 | panic("invalid value got from drive") |
| 191 | } |
| 192 | return utils.ArrayMap(arr, func(t **s.Value) types.IEntry { return sd.valueToEntry(*t) }), nil |
| 193 | } |
| 194 | |
| 195 | func (sd *ScriptDrive) Delete(ctx types.TaskCtx, path string) error { |
| 196 | vm, e := sd.pool.Get(ctx) |