Browse Source

ETS checking

Maxim Sokhatsky 10 years ago
parent
commit
abd5bf28bb
2 changed files with 25 additions and 5 deletions
  1. 18 0
      priv/reltool.config
  2. 7 5
      src/mad_repl.erl

+ 18 - 0
priv/reltool.config

@@ -0,0 +1,18 @@
+{sys, [
+       {lib_dirs, ["apps","deps"]},
+       {erts, [{mod_cond, derived}, {app_file, strip}]},
+       {app_file, strip},
+       {rel, "node", "1", MAD_APPS },
+       {rel, "start_clean", "", [ kernel, stdlib ]},
+       {boot_rel, "node"},
+       {profile, embedded},
+       {incl_cond, derived},
+       {mod_cond, derived},
+       {excl_archive_filters, [".*"]},
+       {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
+                           "^erts.*/(doc|info|include|lib|man|src)"]},
+       {excl_app_filters, ["\.gitignore"]},
+       {app, hipe, [{mod_cond, app}, {incl_cond, exclude}]}
+      ]}.
+
+{target_dir, "node"}.

+ 7 - 5
src/mad_repl.erl

@@ -80,11 +80,7 @@ main(Params) ->
         _ ->  timer:sleep(infinity) end.
 
 load() ->
-
-    case ets:info(filesystem) of
-         undefined -> ets:new(filesystem,[set,named_table,{keypos,1},public]);
-         _ -> skip end,
-
+    ets_created(),
     {ok,Sections} = escript:extract(escript:script_name(),[]),
     [Bin] = [B||{archive,B}<-Sections],
     unfold_zips(Bin).
@@ -99,7 +95,13 @@ unfold_zips(Bin) ->
             _ -> skip end
       end || {U,FileBin} <- Unzip].
 
+ets_created() -> 
+    case ets:info(filesystem) of
+         undefined -> ets:new(filesystem,[set,named_table,{keypos,1},public]);
+         _ -> skip end.
+
 load_file(Name)  ->
+    ets_created(),
     case ets:lookup(filesystem,Name) of
         [{Name,Bin}] -> Bin;
         _ -> <<>> end.