began implementing creating parent directories for output file

This commit is contained in:
Daniel Fichtinger 2024-11-12 02:44:46 -05:00
parent 005f011678
commit 7c89ebebe6

View file

@ -51,6 +51,21 @@ func replaceRoot(inPath, outRoot string) string {
return outPath
}
func createFileWithParents(path string) error {
dir := filepath.Dir(path)
// Check if the parent directory already exists
// before trying to create it
if _, dirErr := os.Stat(dir); os.IsNotExist(dirErr) {
// create directories
err := os.MkdirAll(dir, os.ModePerm)
if err != nil {
return err
}
// TODO: write the file here
}
return nil
}
func processFile(inPath string, entry fs.DirEntry, err error, outRoot string) error {
if err != nil {
return err