synrc / mad

⚡ MAD: Managing Application Dependencies LING/UNIX
https://mad.n2o.dev
Other
173 stars 53 forks source link

Fixed loading of .app config files from ETS filesystem. #59

Closed mkshar closed 8 years ago

mkshar commented 8 years ago

When single-file bundle (escript) built by MAD is deployed, it cannot find apps' configuration file(s) is the ETS filesystem (see comments):

load_config(A) when is_list(A) ->
    AppFile = A ++".app",
    Name = wildcards(["{apps,deps}/*/ebin/"++AppFile,"ebin/"++AppFile]), % here Name will be = []
    case file:read_file(Name) of % there are no files except escript bundle, failed
         {ok,Bin} -> parse(binary_to_list(Bin));
         {error,_} -> case ets:lookup(filesystem,AppFile) of % OK, found .app file is the ETS...
                          [{Name,Bin}] -> parse(binary_to_list(Bin)); % ...but pattern matching failed
                          _ -> [] end end.