mad_create.erl 500 B

123456789101112131415161718
  1. -module(mad_create).
  2. -copyright('Maxim Sokhatsky').
  3. -compile(export_all).
  4. app([]) -> app(["sample"]);
  5. app(Params) ->
  6. [Name] = Params,
  7. mad_repl:load(),
  8. Apps = ets:tab2list(filesystem),
  9. [ case string:str(File,"priv/web") of
  10. 1 -> Relative = Name ++ string:substr(File, 9),
  11. io:format("Create File: ~p~n",[Relative]),
  12. filelib:ensure_dir(Relative),
  13. file:write_file(Relative,Bin);
  14. _ -> skip
  15. end || {File,Bin} <-Apps].
  16. lib(_) -> ok.