Merge branch 'main' into main

This commit is contained in:
Eugen Eisler
2024-12-22 15:56:41 +01:00
committed by GitHub
3 changed files with 32 additions and 3 deletions

View File

@@ -1 +1 @@
"..1"
"1.4.125"

View File

@@ -76,12 +76,19 @@ func main() {
}
// Move the output PDF to the current directory
err = os.Rename(pdfPath, outputFile)
err = copyFile(pdfPath, outputFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Error moving output file: %v\n", err)
os.Exit(1)
}
// Remove the original file after copying
err = os.Remove(pdfPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error cleaning up temporary file: %v\n", err)
os.Exit(1)
}
// Clean up temporary files
cleanupTempFiles(tmpDir)
@@ -103,3 +110,25 @@ func cleanupTempFiles(dir string) {
}
}
}
// Copy a file from source src to destination dst
func copyFile(src, dst string) error {
sourceFile, err := os.Open(src)
if err != nil {
return err
}
defer sourceFile.Close()
destFile, err := os.Create(dst)
if err != nil {
return err
}
defer destFile.Close()
_, err = io.Copy(destFile, sourceFile)
if err != nil {
return err
}
return destFile.Sync()
}

View File

@@ -1,3 +1,3 @@
package main
var version = "v..1"
var version = "v1.4.125"