forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.go
32 lines (29 loc) · 949 Bytes
/
utils.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
package paths
import (
"www.velocidex.com/golang/velociraptor/file_store/api"
"www.velocidex.com/golang/velociraptor/file_store/path_specs"
)
func DSPathSpecFromClientPath(client_path string) api.DSPathSpec {
components := ExtractClientPathComponents(client_path)
result := path_specs.NewUnsafeDatastorePath(components...)
if len(components) > 0 {
last := len(components) - 1
name_type, name := api.GetDataStorePathTypeFromExtension(
components[last])
components[last] = name
return result.SetType(name_type)
}
return result
}
func FSPathSpecFromClientPath(client_path string) api.FSPathSpec {
components := ExtractClientPathComponents(client_path)
result := path_specs.NewUnsafeFilestorePath(components...)
if len(components) > 0 {
last := len(components) - 1
name_type, name := api.GetFileStorePathTypeFromExtension(
components[last])
components[last] = name
return result.SetType(name_type)
}
return result
}