Skip to content

Commit ea04649

Browse files
committed
Compatibility of rsplit (keep -> keepempty)
See also JuliaLang/julia#26647
1 parent 5d20054 commit ea04649

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/WriteVTK.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ using Compat.Printf
2323
using Compat.Base64
2424
using Compat: Nothing, undef
2525

26+
@static if VERSION < v"0.7.0-DEV.4724"
27+
# https://github.com/JuliaLang/julia/pull/26647
28+
rsplit(s::AbstractString; limit::Integer=0, keepempty::Bool=false) =
29+
Base.rsplit(s; limit=limit, keep=keepempty)
30+
rsplit(s::AbstractString, dlm; limit::Integer=0, keepempty::Bool=false) =
31+
Base.rsplit(s, dlm; limit=limit, keep=keepempty)
32+
end
33+
2634
import Base: close, isopen
2735

2836
# Cell type definitions as in vtkCellType.h

src/gridtypes/common.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,7 @@ function save_with_appended_data(vtk::DatasetFile)
270270
@assert vtk.appended
271271

272272
# Convert XML document to a string, and split the last two lines.
273-
# TODO julia 0.7: "keep" is deprecated, use "keepempty" instead
274-
# (https://github.com/JuliaLang/julia/pull/26647)
275-
lines = rsplit(string(vtk.xdoc), '\n', limit=3, keep=true)
273+
lines = rsplit(string(vtk.xdoc), '\n', limit=3, keepempty=true)
276274

277275
# Verify that the last two lines are what they're supposed to be.
278276
@assert lines[2] == "</VTKFile>"

0 commit comments

Comments
 (0)