-
Notifications
You must be signed in to change notification settings - Fork 2
/
file.go
64 lines (47 loc) · 1.22 KB
/
file.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
58
59
60
61
62
63
64
package xar
// #include <stdlib.h>
// #include <xar/xar.h>
import "C"
import "unsafe"
type File struct {
archive *Archive
file C.xar_file_t
}
func (f *File) Verify() bool {
return C.xar_verify(f.archive.archive, f.file) == 0
}
func (f *File) Size() string {
cStr := C.xar_get_size(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Type() string {
cStr := C.xar_get_type(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Mode() string {
cStr := C.xar_get_mode(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Owner() string {
cStr := C.xar_get_owner(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Group() string {
cStr := C.xar_get_group(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Mtime() string {
cStr := C.xar_get_mtime(f.archive.archive, f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}
func (f *File) Path() string {
cStr := C.xar_get_path(f.file)
defer C.free(unsafe.Pointer(cStr))
return C.GoString(cStr)
}