createTempDir creates a tmp/ directory within baseDirectory and returns its path
(baseDirectory config.Path)
| 175 | |
| 176 | // createTempDir creates a tmp/<random string> directory within baseDirectory and returns its path |
| 177 | func createTempDir(baseDirectory config.Path) (types.Path, error) { |
| 178 | baseTmpDir := filepath.Join(string(baseDirectory), "tmp") |
| 179 | if err := os.MkdirAll(baseTmpDir, 0770); err != nil { |
| 180 | return "", fmt.Errorf("failed to create base temp dir: %w", err) |
| 181 | } |
| 182 | tmpDir, err := os.MkdirTemp(baseTmpDir, "") |
| 183 | if err != nil { |
| 184 | return "", fmt.Errorf("failed to create temp dir: %w", err) |
| 185 | } |
| 186 | return types.Path(tmpDir), nil |
| 187 | } |
| 188 | |
| 189 | // createFileWriter creates a buffered file writer with a new file |
| 190 | // The caller should flush the writer before closing the file. |
no outgoing calls
no test coverage detected