+// glocate -- ZFS-diff-friendly locate-like utility
+// Copyright (C) 2022-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
package main
import (
}
isDir = cols[1] == "/"
name := deoctalize(strings.TrimPrefix(cols[2], strip))
+ name = strings.TrimRight(name, "/")
if name == "" {
continue
}
if err != nil {
log.Fatalln(err)
}
- tmp0, err := os.CreateTemp("", "glocate-idx")
+ tmp0, err := os.CreateTemp(TmpDir, "glocate-idx")
if err != nil {
log.Fatalln(err)
}
ent.size = mods[0].size
mods = mods[1:]
}
+ if ent.IsDir() {
+ ent.size = 0
+ }
entsDirSizer <- ent
}
for len(adds) > 0 {