(fullPath string)
| 66 | } |
| 67 | |
| 68 | func (appfiles ApplicationFiles) shaFile(fullPath string) (string, error) { |
| 69 | hash := sha1.New() |
| 70 | file, err := os.Open(fullPath) |
| 71 | if err != nil { |
| 72 | return "", err |
| 73 | } |
| 74 | defer file.Close() |
| 75 | |
| 76 | _, err = io.Copy(hash, file) |
| 77 | if err != nil { |
| 78 | return "", err |
| 79 | } |
| 80 | |
| 81 | return fmt.Sprintf("%x", hash.Sum(nil)), nil |
| 82 | } |
| 83 | |
| 84 | func (appfiles ApplicationFiles) CopyFiles(appFiles []models.AppFileFields, fromDir, toDir string) error { |
| 85 | for _, file := range appFiles { |