|
|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
-behaviour(es_gen_ipc). |
|
|
|
|
|
|
|
-include_lib("kernel/include/file.hrl"). |
|
|
|
|
|
|
|
-compile(inline). |
|
|
|
-compile({inline_size, 128}). |
|
|
|
|
|
|
@ -185,7 +187,7 @@ handleCast({miSyncNode, IsSync}, _, State) -> |
|
|
|
end; |
|
|
|
handleCast(miRescan, _, State) -> |
|
|
|
{Srcs, Hrls, Configs, Beams} = collSrcFiles(false), |
|
|
|
{kpS_S, State#state{srcFiles = Srcs, hrlFiles = Hrls, configs = Configs, beams = Beams}}; |
|
|
|
{noreply, State#state{srcFiles = Srcs, hrlFiles = Hrls, configs = Configs, beams = Beams}, hibernate}; |
|
|
|
handleCast(_Msg, _, _State) -> |
|
|
|
kpS_S. |
|
|
|
|
|
|
@ -235,6 +237,7 @@ handleInfo({Port, {data, Data}}, Status, #state{srcFiles = Srcs, hrlFiles = Hrls |
|
|
|
?logSuccess("eSync connect fileSync success..."), |
|
|
|
%% 然后收集一下监听目录下的src文件 |
|
|
|
{BSrcs, BHrls, BConfigs, BBeams} = collSrcFiles(true), |
|
|
|
?logSuccess("eSync coll src files over..."), |
|
|
|
{nextS, running, State#state{srcFiles = BSrcs, hrlFiles = BHrls, configs = BConfigs, beams = BBeams}, {isHib, true}}; |
|
|
|
_ -> |
|
|
|
?logErrors("error, receive unexpect port msg ~p~n", [Data]), |
|
|
@ -655,7 +658,13 @@ collSrcFiles(IsAddPath) -> |
|
|
|
fun(OneFile, {Srcs, Hrls, Configs, Beams} = Acc) -> |
|
|
|
case isOnlyDir(OnlySrcDirs, OneFile) andalso (not isDelDir(DelSrcDirs, OneFile)) of |
|
|
|
true -> |
|
|
|
MTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
MTimeSec = case file:read_file_info(OneFile, [raw]) of |
|
|
|
{ok, FileInfo} -> |
|
|
|
dateTimeToSec(FileInfo#file_info.mtime); |
|
|
|
_ -> |
|
|
|
0 |
|
|
|
end, |
|
|
|
%MTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
case filename:extension(OneFile) of |
|
|
|
<<".beam">> -> |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>)), |
|
|
|