Skip to content

Commit

Permalink
Merge pull request #2483 from CliMA/gb/remove_old_diagnostics
Browse files Browse the repository at this point in the history
Only merge PDFs that really exist
  • Loading branch information
Sbozzolo authored Jan 5, 2024
2 parents 2bc9365 + 81a1bfe commit 9b90d44
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions post_processing/ci_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function common_dirname(files::Vector{T}) where {T <: AbstractString}
return joinpath(split_files[1][1:last_common_dir]...)
end

# From https://github.com/scheidan/PDFmerger.jl/blob/main/src/PDFmerger.jl
# Based off https://github.com/scheidan/PDFmerger.jl/blob/main/src/PDFmerger.jl
# Licensed under MIT license
import Base.Filesystem
using Poppler_jll: pdfunite, pdfinfo, pdfseparate
Expand All @@ -26,7 +26,10 @@ function merge_pdfs(
destination::AbstractString = joinpath(common_dirname(files), "merged.pdf");
cleanup::Bool = false,
) where {T <: AbstractString}
if destination files
# Filter files to be only files that exist
files = filter(Filesystem.isfile, files)

if destination in files
# rename existing file
Filesystem.mv(destination, destination * "_x_")
files[files .== destination] .= destination * "_x_"
Expand Down

0 comments on commit 9b90d44

Please sign in to comment.