Skip to content

Commit 409d414

Browse files
committed
fix save FileDFG bug, use JSON3
1 parent 68a16ef commit 409d414

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using Reexport
2525
using JSON
2626
using Unmarshal
2727
using JSON2 # JSON2 requires all properties to be in correct sequence, can't guarantee that from DB.
28-
# using JSON3
28+
using JSON3
2929
using LinearAlgebra
3030
using SparseArrays
3131
using UUIDs

src/FileDFG/services/FileDFG.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,12 @@ function saveDFG(folder::AbstractString, dfg::AbstractDFG)
4242
# Variables
4343
for v in variables
4444
vPacked = packVariable(dfg, v)
45-
io = open("$varFolder/$(v.label).json", "w")
46-
println(io,JSON.json(vPacked))
47-
close(io)
45+
JSON3.write("$varFolder/$(v.label).json", vPacked)
4846
end
4947
# Factors
5048
for f in factors
5149
fPacked = packFactor(dfg, f)
52-
io = open("$factorFolder/$(f.label).json", "w")
53-
println(io,JSON.json(fPacked))
54-
close(io)
50+
JSON3.write("$factorFolder/$(f.label).json", fPacked)
5551
end
5652

5753
savedir = dirname(savepath) # is this a path of just local name? #344 -- workaround with unique names

0 commit comments

Comments
 (0)