2016-04-26 80 views
1

我有一個Erlang光束文件,我想得到這個光束的源代碼的目錄路徑。如何獲取Erlang光束文件的源代碼路徑?

([email protected])3> sgnI:module_info().   
[{module,sgnI}, 
{exports,[{get_interface_ip,3}, 
      {get_nc_configuration_by_id,1}, 
      {get_nc_configuration_by_id,2}, 
      {get_nc_configuration_by_id,3}, 
      {possible_update_ipv6,1}, 
      {increase_counter,3}, 
      {local_media_allowed,1}, 
      {create_network_mapping,4}, 
      {create_netw_mapping,4}, 
      {delete_netw_mapping,3}, 
      {check_p_early_media_support,4}, 
      {ip_to_list,1}, 
      {get_web_access_value,2}, 
      {get_ice_support,2}, 
      {check_conf_ip_range,2}, 
      {get_ippbx_configuration,4}, 
      {session_qos_status,2}, 
      {update_qos_statistics,7}, 
      {get_mrfs,0}, 
      {get_nc_information_trc,3}, 
      {get_all_nc_trc,0}, 
      {transcoding_enabled,0}, 
      {get_network_level_codec_policy,3}, 
      {get_domain_level_codec_policy,...}, 
      {...}|...]}, 
{attributes,[{id,['103/190 55-CNA 113 329 Ux']}, 
       {vsn,['/main/R14A/R15A/R18A/R19A/R20A/R21A/R22A/R23A/R24A/R26A/R99A/50']}, 
       {date,['2016-04-21']}, 
       {hrl_id,['18/190 55-CNA 113 211 Ux']}, 
       {hrl_vsn,['/main/R4A/R6A/R6A_1/R9B/R10A/R12A/R13A/R14A/R15A/R16A/R17A/R18A/R19A/R20A/R21A/R22A/R23A/R24A/R26A/R99A/16']}, 
       {hrl_date,['2015-10-28']}, 
       {hrl_id,['135/190 55-CNA 113 329 Ux']}, 
       {hrl_vsn,['/main/R18A/R19A/R20A/R21A/R22A/R23A/R24A/R26A/R99A/11']}, 
       {hrl_date,['2015-10-01']}, 
       {hrl_id,['21/190 55-CNA 113 211 Ux']}, 
       {hrl_vsn,['/main/R4A/R6A/R6A_1/R9B/R10A/R12A/R13A/R14A/R15A/R16A/R17A/R18A/R19A/R20A/R21A/R22A/R23A/R24A/R26A/R99A/29']}, 
       {hrl_id,['59/190 55-CNA 113 329 Ux']}, 
       {hrl_vsn,['/main/R13A/R14A/R15A/R16A/R17A/R18A/R19A/R21A/R22A/R23A/R24A/R99A/5']}, 
       {hrl_date,['2015-11-12']}, 
       {hrl_author,[eaeghkl]}]}, 
{compile,[{options,[debug_info, 
        {outdir,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGN_CNA113329/out"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGN_CNA113329/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGC_CXA112584/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGM_CNA113211/SGM_CXA112475/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/REG_CNA113206/REG_CXA112470/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SNI_CNA113330/SNI_CXA112605/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/DIA_CNA113193/DIA_CXA112460/inc"}, 
        {i,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/CHA_CNA113194/CHA_CXA112461/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/SYF_CXA112264/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/SYS_CNA11333/SYS_CXA112238/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/OMS_CNA11344/OMS_CXA112249/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/PERF_CNA113086/PERF_CXA112373/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/EVIP_CNA113361/EVIP_CXA112623/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/SMM_CNA113305/SMM_CXA112593/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/PLC_CNA11345/PLC_CXA112250/inc"}, 
        {i,"/vobs/mgwblade/SYF/SYF_CRA1190070/EQM_CNA113159/EQM_CXA112430/inc"}, 
        {i,[...]}, 
        {i,...}, 
        {...}|...]}, 
      {version,"6.0.2"}, 
      {time,{2016,4,21,18,26,41}}, 
      {source,"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGN_CNA113329/src/sgnI.erl"}]}, 
{md5,<<124,118,79,184,84,57,4,46,95,153,149,41,117,11,1, 
     139>>}] 

我想"/vobs/mgwblade/SGC/SGC_CSA10105_4/SGC_CRA1190962/SGN_CNA113329/src/sgnI.erl",但module_info()似乎不是正確的方式。有沒有其他方法?

回答

4
1> proplists:get_value(source,lists:module_info(compile)). 
"/net/isildur/ldisk/daily_build/18_prebuild_master-opu_o.2015-06-23_20/otp_src_18/lib/stdlib/src/lists.erl" 
+0

沒有其他更簡單的方法嗎? – BlackMamba

+0

如果你自己編譯'beam'文件,你可以在編譯時使用'-D'('erlc'編譯選項)或'{d,「/ some/path」}作爲任意屬性添加它編譯模塊。 – Amiramix

+0

@BlackMamba您想以何種方式使解決方案更簡單?這隻需要兩個函數調用即可獲得所需的信息。 – legoscia

相關問題