MCPcopy
hub / github.com/spicetify/cli / CopyFile

Function CopyFile

src/utils/utils.go:141–163  ·  view source on GitHub ↗

CopyFile .

(srcPath, dest string)

Source from the content-addressed store, hash-verified

139
140// CopyFile .
141func CopyFile(srcPath, dest string) error {
142 fSrc, err := os.Open(srcPath)
143 if err != nil {
144 return err
145 }
146 defer fSrc.Close()
147
148 CheckExistAndCreate(dest)
149 destPath := filepath.Join(dest, filepath.Base(srcPath))
150 fDest, err := os.OpenFile(
151 destPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0700)
152 if err != nil {
153 return err
154 }
155 defer fDest.Close()
156
157 _, err = io.Copy(fDest, fSrc)
158 if err != nil {
159 return err
160 }
161
162 return nil
163}
164
165// Replace uses Regexp to find any matched from `input` with `regexpTerm`
166// and replaces them with `replaceTerm` then returns new string.

Callers 5

ApplyFunction · 0.92
refreshThemeJSFunction · 0.92
pushExtensionsFunction · 0.92
RefreshAppsFunction · 0.92
AdditionalOptionsFunction · 0.92

Calls 1

CheckExistAndCreateFunction · 0.85

Tested by

no test coverage detected