Skip to content

Commit

Permalink
Fixes bug where existing output dir exits
Browse files Browse the repository at this point in the history
This commit allows the program to continue if the output directory
exists. This makes it possible to resume a render when some files have
already been transcoded.
  • Loading branch information
topfunky committed May 4, 2024
1 parent 75893b4 commit 28119bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion find_and_transcode_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type FileToRender struct {
func findFiles(sourceDir, destinationDir string) error {
fmt.Printf("🔍 Finding files in source directory %s\n", sourceDir)

if err := os.Mkdir(destinationDir, 0755); err != nil {
if err := os.MkdirAll(destinationDir, 0755); err != nil {
return fmt.Errorf("Failed to create destination directory: %v", err)
}

Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
)

func main() {
Expand All @@ -12,5 +13,7 @@ func main() {

sourceDir := *sourcePtr
destinationDir := *destinationPtr
findFiles(sourceDir, destinationDir)
if err := findFiles(sourceDir, destinationDir); err != nil {
fmt.Println("Error:", err)
}
}

0 comments on commit 28119bb

Please sign in to comment.