the returned file should be closed by the caller
(path string, flag int, perm os.FileMode)
| 63 | |
| 64 | // the returned file should be closed by the caller |
| 65 | func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error) { |
| 66 | cleanPath, err := EscapeTilde(path) |
| 67 | if err != nil { |
| 68 | return nil, err |
| 69 | } |
| 70 | |
| 71 | file, err := os.OpenFile(cleanPath, flag, perm) |
| 72 | if err != nil { |
| 73 | return nil, errors.Wrap(err, errors.Message(ErrorCreateFile(path))) |
| 74 | } |
| 75 | |
| 76 | return file, err |
| 77 | } |
| 78 | |
| 79 | // the returned file should be closed by the caller |
| 80 | func Create(path string) (*os.File, error) { |
no test coverage detected