mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/fs: use filepath.Dir instead of filepath.Split, since the filename is unused
This commit is contained in:
parent
20fc0e0e54
commit
afb964670a
1 changed files with 3 additions and 2 deletions
|
@ -113,7 +113,7 @@ func WriteFile(path string, data []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot obtain absolute path to %q: %s", path, err)
|
return fmt.Errorf("cannot obtain absolute path to %q: %s", path, err)
|
||||||
}
|
}
|
||||||
parentDirPath, _ := filepath.Split(absPath)
|
parentDirPath := filepath.Dir(absPath)
|
||||||
SyncPath(parentDirPath)
|
SyncPath(parentDirPath)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -191,7 +191,8 @@ func IsPathExist(path string) bool {
|
||||||
// and syncs the parent directory, so it no longer contains the path.
|
// and syncs the parent directory, so it no longer contains the path.
|
||||||
func MustRemoveAllSynced(path string) {
|
func MustRemoveAllSynced(path string) {
|
||||||
MustRemoveAll(path)
|
MustRemoveAll(path)
|
||||||
SyncPath(filepath.Dir(path))
|
parentDirPath := filepath.Dir(path)
|
||||||
|
SyncPath(parentDirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustRemoveAll removes path with all the contents.
|
// MustRemoveAll removes path with all the contents.
|
||||||
|
|
Loading…
Reference in a new issue