Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Load all erlang modules in path
- %% autoload all modules that are in the code:path() and reside in the user directory
- %% put in ~/.erlang
- [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
- || P <- lists:filter(fun(Path) -> string:str(Path, os:getenv("USER")) > 0 end, code:get_path()), F <- filelib:wildcard(P ++ "/*.beam")].
- %% 我的更新
- [io:format("~p~n",[F]) ||
- P <- lists:filter(fun(Path) -> string:str(Path, "erlang") /= 0 end, code:get_path()),
- F <- filelib:wildcard(P ++ "/*.beam")].
- %% 摘抄自stack overflow
- [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
- || P <- code:get_path(), F <- filelib:wildcard(P ++ "/*.beam")].
- %% if you spawn the process, you will get a very fast start.
- LP = fun() -> [code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F)))) ||
- P <- code:get_path(), F <- filelib:wildcard(P ++ "/*.beam")] end.
- spawn(LP).
Add Comment
Please, Sign In to add comment