diff options
author | Kevin Walzer <kw@codebykevin.com> | 2021-07-06 17:53:39 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2021-07-06 17:53:39 (GMT) |
commit | 064f7238e77a06ab9008f739090eea8354c4f764 (patch) | |
tree | 573162bdeb836b8c850d3523fa26a8a50de5a71c /macosx | |
parent | 0c15d1665c5a0a735ff6db449bf786c33e4759a5 (diff) | |
download | tk-064f7238e77a06ab9008f739090eea8354c4f764.zip tk-064f7238e77a06ab9008f739090eea8354c4f764.tar.gz tk-064f7238e77a06ab9008f739090eea8354c4f764.tar.bz2 |
Fix error with PDF export from Mac printer dialog
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXPrint.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c index ec0b636..9d5e9a7 100644 --- a/macosx/tkMacOSXPrint.c +++ b/macosx/tkMacOSXPrint.c @@ -228,10 +228,16 @@ OSStatus FinishPrint(NSString * file, int buttonValue) { */ if ([pathExtension isEqualToString: @ "pdf"]) { NSFileManager * fileManager = [NSFileManager defaultManager]; + NSError * error = nil; + /*Make sure no file conflict exists.*/ + if ([fileManager fileExistsAtPath: finalPath]) { + [fileManager removeItemAtPath: finalPath error: &error]; + } if ([fileManager fileExistsAtPath: sourcePath]) { NSError * error = nil; [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error]; } + return status; } /* Is the target file PostScript? If so, run print file |