-
Notifications
You must be signed in to change notification settings - Fork 43
/
config.go
57 lines (48 loc) · 1.5 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package fsds
import (
"fmt"
"os"
"github.com/FleekHQ/space-daemon/core/space"
)
var DefaultBucketName = "personal"
type dataSourceConfig struct {
tlfSources []*TLFDataSource
}
type FSDataSourceConfig func(config *dataSourceConfig)
func WithTLFDataSource(source *TLFDataSource) FSDataSourceConfig {
return func(config *dataSourceConfig) {
config.tlfSources = append(config.tlfSources, source)
}
}
// Configure the default 'Files` data source to be included as a data source
func WithFilesDataSources(service space.Service) FSDataSourceConfig {
basePath := fmt.Sprintf("%cFiles", os.PathSeparator)
return WithTLFDataSource(&TLFDataSource{
name: "Files",
basePath: basePath,
FSDataSource: &filesDataSource{service: service},
})
}
// Configure the default 'Shared With Me` data source to be included as a data source
func WithSharedWithMeDataSources(service space.Service) FSDataSourceConfig {
basePath := fmt.Sprintf("%cShared With Me", os.PathSeparator)
return WithTLFDataSource(&TLFDataSource{
name: "Shared With Me",
basePath: basePath,
FSDataSource: &sharedWithMeDataSource{
service: service,
maxDirLimit: 1000,
cache: make(map[string]*sharedFileEntry),
},
})
}
var blackListedDirEntryNames = map[string]bool{
// OSX specific special directories
".Trashes": true,
".localized": true,
".fseventsd": true,
".ql_disablethumbnails": true,
".ql_disablecache": true,
// special space empty directory file
".keep": true,
}