author | Mikael Berthe <mikael@lilotux.net> |
Sun, 29 Jun 2014 18:30:02 +0200 | |
changeset 20 | f7ce9d750e83 |
parent 18 | 5219596f5c71 |
permissions | -rw-r--r-- |
18
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
1 |
// |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
2 |
// Copyright (C) 2014 Mikael Berthe <mikael@lilotux.net> |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
3 |
// |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
4 |
// This program is free software; you can redistribute it and/or modify |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
5 |
// it under the terms of the GNU General Public License as published by |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
6 |
// the Free Software Foundation; either version 2 of the License, or (at |
5219596f5c71
Change comments so that build constraints still work
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
7 |
// your option) any later version. |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
8 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
9 |
// +build plan9 windows |
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 |
package main |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
12 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
13 |
import "os" |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
14 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
15 |
// ByInode is a FileObjList type with a sort interface |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
16 |
type ByInode FileObjList |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
17 |
|
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
18 |
func (a ByInode) Len() int { return len(a) } |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
19 |
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
|
20 |
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
|
21 |
return a[i].FilePath < a[j].FilePath |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
22 |
} |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
23 |
|
3
d08d45871171
Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
24 |
// 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
|
25 |
func OSHasInodes() bool { |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 |
return false |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
27 |
} |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
28 |
|
3
d08d45871171
Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
29 |
// 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
|
30 |
// This is not supported on Windows and Plan9. |
0
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
31 |
func GetDevIno(fi os.FileInfo) (uint64, uint64) { |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
32 |
return 0, 0 // Not supported |
a5642cd03cef
Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
33 |
} |