-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: D <[email protected]>
- Loading branch information
Showing
4 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// +build !windows | ||
|
||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package fileutil | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// SyncDir fsyncs the given dir | ||
func SyncDir(dirPath string) error { | ||
dir, err := os.Open(dirPath) | ||
if err != nil { | ||
return errors.Wrapf(err, "error while opening dir:%s", dirPath) | ||
} | ||
if err := dir.Sync(); err != nil { | ||
dir.Close() | ||
return errors.Wrapf(err, "error while synching dir:%s", dirPath) | ||
} | ||
if err := dir.Close(); err != nil { | ||
return errors.Wrapf(err, "error while closing dir:%s", dirPath) | ||
} | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package fileutil | ||
|
||
// SyncDir this is a noop on windows | ||
func SyncDir(dirPath string) error { | ||
return nil | ||
} |