@@ -58,11 +58,15 @@ function saveDFG(dfg::AbstractDFG, folder::String; compress::Symbol=:null)
58
58
close (io)
59
59
end
60
60
61
- savedir = dirname (savepath)
61
+ savedir = dirname (savepath) # is this a path of just local name? #344 -- workaround with unique names
62
62
savename = basename (string (savepath))
63
63
@assert savename != " "
64
64
destfile = joinpath (savedir, savename* " .tar.gz" )
65
- run ( pipeline (` tar -zcf - -C $savedir $savename ` , stdout = " $destfile " ))
65
+ if length (savedir) != 0
66
+ run ( pipeline (` tar -zcf - -C $savedir $savename ` , stdout = " $destfile " ))
67
+ else
68
+ run ( pipeline (` tar -zcf - $savename ` , stdout = " $destfile " ))
69
+ end
66
70
Base. rm (joinpath (savedir,savename), recursive= true )
67
71
end
68
72
@@ -82,7 +86,14 @@ loadDFG("/tmp/savedgraph.tar.gz", IncrementalInference, dfg)
82
86
ls(dfg)
83
87
```
84
88
"""
85
- function loadDFG (dst:: String , iifModule, dfgLoadInto:: G ; loaddir= joinpath (" /" ," tmp" ," caesar" ," random" )) where G <: AbstractDFG
89
+ function loadDFG (dst:: String ,
90
+ iifModule:: Module ,
91
+ dfgLoadInto:: G ) where G <: AbstractDFG
92
+
93
+
94
+ #
95
+ # loaddir gets deleted so needs to be unique
96
+ loaddir= joinpath (" /" ," tmp" ," caesar" ," random" , string (uuid1 ()))
86
97
# Check if zipped destination (dst) by first doing fuzzy search from user supplied dst
87
98
folder = dst # working directory for fileDFG variable and factor operations
88
99
dstname = dst # path name could either be legacy FileDFG dir or .tar.gz file of FileDFG files.
@@ -149,9 +160,9 @@ function loadDFG(dst::String, iifModule, dfgLoadInto::G; loaddir=joinpath("/","t
149
160
150
161
# remove the temporary unzipped file
151
162
if unzip
152
- @info " DFG.loadDFG is deleting a temp folder created during unzip, $folder "
163
+ @info " DFG.loadDFG is deleting a temp folder created during unzip, $loaddir "
153
164
# need this because the number of files created in /tmp/caesar/random is becoming redonkulous.
154
- Base. rm (folder , recursive= true )
165
+ Base. rm (loaddir , recursive= true )
155
166
end
156
167
157
168
return dfgLoadInto
0 commit comments