Skip to content

Commit 8f9cfdb

Browse files
committed
allow both saveDFG argument orders,
fix #581
1 parent 182a5b6 commit 8f9cfdb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/FileDFG/services/FileDFG.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ v1 = addVariable!(dfg, :a, ContinuousScalar, labels = [:POSE], solvable=0)
1717
saveDFG(dfg, "/tmp/saveDFG.tar.gz")
1818
```
1919
"""
20-
function saveDFG( dfg::AbstractDFG, folder::AbstractString )
20+
function saveDFG(folder::AbstractString, dfg::AbstractDFG)
2121

22-
# TODO: Deprecate the folder functionality in v0.6.1
22+
# TODO: Deprecate the folder functionality
2323

2424
# Clean up save path if a file is specified
2525
savepath = folder[end] == '/' ? folder[1:end-1] : folder
@@ -65,6 +65,8 @@ function saveDFG( dfg::AbstractDFG, folder::AbstractString )
6565
end
6666
Base.rm(joinpath(savedir,savename), recursive=true)
6767
end
68+
# support both argument orders, #581
69+
saveDFG(dfg::AbstractDFG, folder::AbstractString) = saveDFG(folder, dfg)
6870

6971
"""
7072
$(SIGNATURES)

test/fileDFGTests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using Test
4747
# facts[4].solverData.potentialused = true
4848
# updateFactor!(dfg, facts[4])
4949
# Save and load the graph to test.
50-
saveDFG(dfg, filename)
50+
saveDFG(filename, dfg)
5151

5252
copyDfg = DistributedFactorGraphs._getDuplicatedEmptyDFG(dfg)
5353
copyDf2 = DistributedFactorGraphs._getDuplicatedEmptyDFG(dfg)
@@ -75,5 +75,7 @@ using Test
7575
@test_broken typeof(getDataEntry(getVariable(retDFG, :x2),:testing2)) == BlobStoreEntry
7676
end
7777

78+
# test the duplicate order #581
79+
saveDFG(dfg, filename)
7880
end
7981
end

0 commit comments

Comments
 (0)