MCPcopy Index your code
hub / github.com/cloudfoundry/cli / copyFile

Method copyFile

cf/appfiles/app_files.go:138–164  ·  view source on GitHub ↗
(srcPath string, dstPath string, fileMode os.FileMode)

Source from the content-addressed store, hash-verified

136}
137
138func (appfiles ApplicationFiles) copyFile(srcPath string, dstPath string, fileMode os.FileMode) error {
139 dst, err := fileutils.Create(dstPath)
140 if err != nil {
141 return err
142 }
143 defer dst.Close()
144
145 if runtime.GOOS != "windows" {
146 err = dst.Chmod(fileMode)
147 if err != nil {
148 return err
149 }
150 }
151
152 src, err := os.Open(srcPath)
153 if err != nil {
154 return err
155 }
156 defer src.Close()
157
158 _, err = io.Copy(dst, src)
159 if err != nil {
160 return err
161 }
162
163 return nil
164}
165
166func (appfiles ApplicationFiles) CountFiles(directory string) int64 {
167 var count int64

Callers 1

CopyFilesMethod · 0.95

Calls 2

CreateMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected