mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-10 06:48:04 -05:00
Merge branch 'main' into main
This commit is contained in:
@@ -1 +1 @@
|
||||
"..1"
|
||||
"1.4.125"
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
var version = "v..1"
|
||||
var version = "v1.4.125"
|
||||
Reference in New Issue
Block a user