summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/afero/unionFile.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-04-25 23:50:10 +0200
committerGitHub <noreply@github.com>2022-04-25 23:50:10 +0200
commit67adad3e08fe17d5f7e87468ea47aa76e1662255 (patch)
tree91314fac90d39254e66ae794decfcd21c10a7b20 /vendor/github.com/spf13/afero/unionFile.go
parent2fca3c756373577eab4e0120ccce62eecc1f5ad8 (diff)
downloadmatterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.tar.gz
matterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.tar.bz2
matterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.zip
Update dependencies (#1813)
Diffstat (limited to 'vendor/github.com/spf13/afero/unionFile.go')
-rw-r--r--vendor/github.com/spf13/afero/unionFile.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/vendor/github.com/spf13/afero/unionFile.go b/vendor/github.com/spf13/afero/unionFile.go
index 985363ee..34f99a40 100644
--- a/vendor/github.com/spf13/afero/unionFile.go
+++ b/vendor/github.com/spf13/afero/unionFile.go
@@ -268,13 +268,7 @@ func (f *UnionFile) WriteString(s string) (n int, err error) {
return 0, BADFD
}
-func copyToLayer(base Fs, layer Fs, name string) error {
- bfh, err := base.Open(name)
- if err != nil {
- return err
- }
- defer bfh.Close()
-
+func copyFile(base Fs, layer Fs, name string, bfh File) error {
// First make sure the directory exists
exists, err := Exists(layer, filepath.Dir(name))
if err != nil {
@@ -315,3 +309,23 @@ func copyToLayer(base Fs, layer Fs, name string) error {
}
return layer.Chtimes(name, bfi.ModTime(), bfi.ModTime())
}
+
+func copyToLayer(base Fs, layer Fs, name string) error {
+ bfh, err := base.Open(name)
+ if err != nil {
+ return err
+ }
+ defer bfh.Close()
+
+ return copyFile(base, layer, name, bfh)
+}
+
+func copyFileToLayer(base Fs, layer Fs, name string, flag int, perm os.FileMode) error {
+ bfh, err := base.OpenFile(name, flag, perm)
+ if err != nil {
+ return err
+ }
+ defer bfh.Close()
+
+ return copyFile(base, layer, name, bfh)
+}