Checks if the provided dir prefix doesn't have any files. A trailing slash will be appended to a non-empty dir string argument to ensure that the checked prefix is a "directory". Returns "false" in case the has at least one file, otherwise - "true".
(dir string)
| 384 | // |
| 385 | // Returns "false" in case the has at least one file, otherwise - "true". |
| 386 | func (s *System) IsEmptyDir(dir string) bool { |
| 387 | if dir != "" && !strings.HasSuffix(dir, "/") { |
| 388 | dir += "/" |
| 389 | } |
| 390 | |
| 391 | iter := s.bucket.List(&blob.ListOptions{ |
| 392 | Prefix: dir, |
| 393 | }) |
| 394 | |
| 395 | _, err := iter.Next(s.ctx) |
| 396 | |
| 397 | return err != nil && errors.Is(err, io.EOF) |
| 398 | } |
| 399 | |
| 400 | var inlineServeContentTypes = []string{ |
| 401 | // image |