fix double extensions in savefig

This commit is contained in:
Daniel Schwabeneder 2020-04-22 19:28:12 +02:00
parent 77b5951037
commit 4e877a206e

View File

@ -93,6 +93,8 @@ const _savemap = Dict(
"txt" => txt, "txt" => txt,
) )
const _extension_map = Dict("tikz" => "tex")
function getExtension(fn::AbstractString) function getExtension(fn::AbstractString)
pieces = split(fn, ".") pieces = split(fn, ".")
length(pieces) > 1 || error("Can't extract file extension: ", fn) length(pieces) > 1 || error("Can't extract file extension: ", fn)
@ -104,7 +106,7 @@ end
function addExtension(fn::AbstractString, ext::AbstractString) function addExtension(fn::AbstractString, ext::AbstractString)
try try
oldext = getExtension(fn) oldext = getExtension(fn)
if string(_savemap[oldext]) == ext if get(_extesion_map, oldext, oldext) == ext
return fn return fn
else else
return "$fn.$ext" return "$fn.$ext"