author | Mikael Berthe <mikael@lilotux.net> |
Sun, 29 Jun 2014 15:47:04 +0200 | |
changeset 15 | 4e3a67dc70a0 |
parent 11 | 47e45453b705 |
child 17 | 7e73bb91665e |
permissions | -rw-r--r-- |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
1 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
2 |
// +build plan9 windows |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
3 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
4 |
package main |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
5 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
6 |
import "os" |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
7 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
8 |
// ByInode is a FileObjList type with a sort interface |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
9 |
type ByInode FileObjList |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
10 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
11 |
func (a ByInode) Len() int { return len(a) } |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
12 |
func (a ByInode) Swap(i, j int) { a[i], a[j] = a[j], a[i] } |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
13 |
func (a ByInode) Less(i, j int) bool { |
11
47e45453b705
Sort files by path when sorting by inode number is not supported
Mikael Berthe <mikael@lilotux.net>
parents:
3
diff
changeset
|
14 |
return a[i].FilePath < a[j].FilePath |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
15 |
} |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
16 |
|
3
d08d45871171
Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
17 |
// OSHasInodes returns true iff the O.S. uses inodes for its filesystems. |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
18 |
func OSHasInodes() bool { |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
19 |
return false |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
20 |
} |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
21 |
|
3
d08d45871171
Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
22 |
// GetDevIno returns the device and inode IDs of a given file. |
d08d45871171
Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
23 |
// This is not supported on Windows and Plan9. |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
24 |
func GetDevIno(fi os.FileInfo) (uint64, uint64) { |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
25 |
return 0, 0 // Not supported |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 |
} |