@@ -122,10 +122,7 @@ handle_call({filename, FlowId}, _From, FlowStore) ->
122122 {reply , error , FlowStore }
123123 end ;
124124handle_call ({retrieve_main_flow }, _From , FlowStore ) ->
125- SrcFileName = io_lib :format (
126- " ~s /flows.json" ,
127- [code :priv_dir (erlang_red )]
128- ),
125+ SrcFileName = ered_flow_store :store_main_flow (),
129126
130127 {reply , file :read_file (SrcFileName ), FlowStore };
131128handle_call (_Msg , _From , FlowStore ) ->
@@ -146,10 +143,7 @@ handle_info({store_main_flow, FlowData}, State) ->
146143 % % remove any reference to <<"credentials">>
147144 NodeAry = remove_credentials (NodeAryWithCreds ),
148145
149- DestFileName = io_lib :format (
150- " ~s /flows.json" ,
151- [code :priv_dir (erlang_red )]
152- ),
146+ DestFileName = ered_flow_store :store_main_flow (),
153147
154148 filelib :ensure_dir (DestFileName ),
155149 case file :write_file (DestFileName , encode_json (NodeAry )) of
@@ -170,10 +164,7 @@ handle_info({store_flow, FlowId, JsonText}, FlowStore) ->
170164 % % remove any reference to <<"credentials">>
171165 NodeAry = remove_credentials (json :decode (NodeAryWithCreds )),
172166
173- DestFileName = io_lib :format (
174- " ~s /testflows/~s /flows.json" ,
175- [code :priv_dir (erlang_red ), FlowId ]
176- ),
167+ DestFileName = ered_flow_store :store_flow_id (FlowId ),
177168
178169 filelib :ensure_dir (DestFileName ),
179170 case file :write_file (DestFileName , encode_json (NodeAry )) of
@@ -237,12 +228,10 @@ remove_credentials([NodeDef | Rest], Store) ->
237228compile_file_list () ->
238229 {ok , MP } = re :compile (" ([A-Z0-9]{16})/flows.json" , [caseless ]),
239230
240- TestFlowDir = io_lib :format (" ~s /testflows/" , [code :priv_dir (erlang_red )]),
231+ TestFlowDir = filename :join (code :priv_dir (erlang_red ), " testflows" ),
232+ StoreFlowDir = ered_flow_store :store_flow (),
241233
242- FileNames = filelib :fold_files (
243- TestFlowDir ,
244- " flows.json" ,
245- true ,
234+ Fun =
246235 fun (Fname , Acc ) ->
247236 case re :run (Fname , MP ) of
248237 {match , [{_ , _ }, {S , L }]} ->
@@ -251,9 +240,11 @@ compile_file_list() ->
251240 Acc
252241 end
253242 end ,
254- []
255- ),
256- FileNames .
243+
244+ FileNames0 = filelib :fold_files (TestFlowDir , " flows.json" , true , Fun , []),
245+ FileNames1 = filelib :fold_files (StoreFlowDir , " flows.json" , true , Fun , []),
246+
247+ FileNames0 ++ FileNames1 .
257248
258249% % erlfmt:ignore lining stuff up
259250compile_file_store ([], FileStore ) ->
0 commit comments