}
dir := filepath.Dir(file.Path)
- base := filepath.Base(file.Path)
+ // Create hidden file which should be ignored by most other tools and
+ // thus not affect anything during creation
+ base := "." + filepath.Base(file.Path)
var tmpPath string
switch file.Mode.Type() {
case 0: // regular file
debugf("creating temporary file %q",
- filepath.Join(dir, "."+base+"*"))
- // Create hidden file which should be ignored by most other
- // tools and thus not affect anything during creation
- newFh, err := os.CreateTemp(dir, "."+base)
+ filepath.Join(dir, base+"*"))
+ newFh, err := os.CreateTemp(dir, base)
if err != nil {
return err
}
// Similar to os.CreateTemp() but for symlinks which we cannot
// open as file
tmpPath = filepath.Join(dir,
- "."+base+strconv.Itoa(rand.Int()))
+ base+strconv.Itoa(rand.Int()))
debugf("creating temporary symlink %q", tmpPath)
err := os.Symlink(string(file.Data), tmpPath)
if err != nil {