change tmp name
Signed-off-by: Tiger <rbalajis25@gmail.com>
Tiger committed
May 7, 2020 at 23:34 UTC
03b1a603c3c7a8b7de79dc9ea04012f14af761de
1 file changed
+2
-2
repo/fsrepo/fsrepo.go
+2
-2
@@ -361,7 +361,7 @@ func (r *FSRepo) Path() string {
361
func (r *FSRepo) SetAPIAddr(addr ma.Multiaddr) error {
362
// Create a temp file to write the address, so that we don't leave empty file when the
363
// program crashes after creating the file.
364
- f, err := os.Create(filepath.Join(r.path, apiFile+"-tmp"))
364
+ f, err := os.Create(filepath.Join(r.path, "."+apiFile+".tmp"))
365
if err != nil {
366
return err
367
}
@@ -374,7 +374,7 @@ func (r *FSRepo) SetAPIAddr(addr ma.Multiaddr) error {
374
}
375
376
// Atomically rename the temp file to the correct file name.
377
- return os.Rename(filepath.Join(r.path, apiFile+"-tmp"), filepath.Join(r.path, apiFile))
377
+ return os.Rename(filepath.Join(r.path, "."+apiFile+".tmp"), filepath.Join(r.path, apiFile))
378
}
379
380
// openConfig returns an error if the config file is not present.