22
22
23
23
init_schemas (App , Config ) ->
24
24
DepsDir = ? config (erlang_mk_depsdir , Config ),
25
- % Note: the schema for the rabbit app is named "rabbitmq.schema"
26
- RabbitSchema = filename :join ([DepsDir , " rabbit" , " priv" , " schema" , " rabbitmq.schema" ]),
25
+ RabbitSchema = find_app_schema (rabbit , DepsDir ),
27
26
Schemas = case App of
28
27
rabbit -> [RabbitSchema ];
29
28
_ -> [RabbitSchema , find_app_schema (App , DepsDir )]
@@ -46,20 +45,21 @@ init_schemas(App, Config) ->
46
45
]).
47
46
48
47
find_app_schema (App , DepsDir ) ->
49
- Schema = get_schema_for ([DepsDir , App , " priv " ], App ),
50
- does_schema_exist (filelib :is_regular (Schema ), App , DepsDir , Schema , cont ).
48
+ SchemaFile = get_schema_for ([DepsDir , App ], App ),
49
+ does_schema_exist (filelib :is_regular (SchemaFile ), App , DepsDir , SchemaFile , cont ).
51
50
52
- does_schema_exist (true , _App , _DepsDir , Schema , _ ) ->
53
- Schema ;
54
- does_schema_exist (false , App , _DepsDir , _Schema , stop ) ->
51
+ does_schema_exist (true , _App , _DepsDir , SchemaFile , _ ) ->
52
+ SchemaFile ;
53
+ does_schema_exist (false , App , _DepsDir , _SchemaFile , stop ) ->
55
54
ct :fail (" Could not find schema for app: ~p~n " , [App ]);
56
- does_schema_exist (false , App , DepsDir , _Schema , cont ) ->
55
+ does_schema_exist (false , App , DepsDir , _SchemaFile , cont ) ->
57
56
% If not in umbrella, priv will be at ../priv
58
- Schema = get_schema_for ([DepsDir , " .." , " priv " ], App ),
59
- does_schema_exist (filelib :is_regular (Schema ), App , DepsDir , Schema , stop ).
57
+ SchemaFile = get_schema_for ([DepsDir , " .." ], App ),
58
+ does_schema_exist (filelib :is_regular (SchemaFile ), App , DepsDir , SchemaFile , stop ).
60
59
61
60
get_schema_for (Prefix , App ) ->
62
- filename :join (Prefix ++ [" schema" , atom_to_list (App ) ++ " .schema" ]).
61
+ SchemaFileName = atom_to_list (App ) ++ " .schema" ,
62
+ filename :join (Prefix ++ [" priv" , " schema" , SchemaFileName ]).
63
63
64
64
copy_to (File , Dir ) ->
65
65
BaseName = filename :basename (File ),
0 commit comments