Guest User

Untitled

a guest
Apr 25th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. %% Load all erlang modules in path
  2. %% autoload all modules that are in the code:path() and reside in the user directory
  3. %% put in ~/.erlang
  4. [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
  5. || P <- lists:filter(fun(Path) -> string:str(Path, os:getenv("USER")) > 0 end, code:get_path()), F <- filelib:wildcard(P ++ "/*.beam")].
  6.  
  7. %% 我的更新
  8. [io:format("~p~n",[F]) ||
  9. P <- lists:filter(fun(Path) -> string:str(Path, "erlang") /= 0 end, code:get_path()),
  10. F <- filelib:wildcard(P ++ "/*.beam")].
  11.  
  12. %% 摘抄自stack overflow
  13. [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
  14. || P <- code:get_path(), F <- filelib:wildcard(P ++ "/*.beam")].
  15.  
  16. %% if you spawn the process, you will get a very fast start.
  17. LP = fun() -> [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F)))) ||
  18. P <- code:get_path(), F <- filelib:wildcard(P ++ "/*.beam")] end.
  19. spawn(LP).
Add Comment
Please, Sign In to add comment