azynheira / distel

Automatically exported from code.google.com/p/distel
0 stars 0 forks source link

Cannot find source file under subdirectories under src/ #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a project where source codes are under subdirectories under src/,
for example, in erlyweb, src/components,
2. M-. does not find source file.

What is the expected output? What do you see instead?

M-. should find source but it complained about unable to find file.

What version of the product are you using? On what operating system?

3.3 from trunk as of 2007/7/15

Please provide any additional information below.

The following patch to distel.erl searches ../src/* in addition to ../src,
 and this makes the above work.

yym3:src/distel(212):svn diff 
Index: src/distel.erl
===================================================================
--- src/distel.erl      (revision 34)
+++ src/distel.erl      (working copy)
@@ -151,6 +151,21 @@
             {error, fmt("Can't find module '~p' on ~p", [Mod, node()])}
     end.

+get_all_src_subdirs(Dir, SrcName) ->
+    case file:list_dir(Dir) of 
+  {error, _} ->
+      undefined;
+  {ok, Listing} ->
+      lists:foldl(
+        fun (Name, Acc) ->
+           Path = join([Dir, Name]),
+           case file:read_file_info(Path) of
+         {ok, #file_info{type=directory}} -> [join([Path,SrcName]) | Acc];
+         _ -> Acc
+           end
+        end, [], Listing)
+    end.
+
 %% Ret: {true, AbsName} | false
 guess_source_file(Mod, BeamFName) ->
     Erl = to_list(Mod) ++ ".erl",
@@ -158,9 +173,11 @@
     DotDot = dirname(Dir),
     TryL = [src_from_beam(Mod),
             join([Dir, Erl]),
-            join([DotDot, src, Erl]),
-            join([DotDot, esrc, Erl]),
+            join([DotDot, src, Erl])] ++
+      get_all_src_subdirs(join([DotDot, src]), Erl) ++
+            [join([DotDot, esrc, Erl]),
             join([DotDot, erl, Erl])],
+    io:format("~p~n", [TryL]),
     try_srcs(TryL).

 try_srcs([]) -> false;

Original issue reported on code.google.com by hao...@gmail.com on 20 Jul 2007 at 2:40

GoogleCodeExporter commented 8 years ago

Original comment by mats.cro...@gmail.com on 20 Jul 2007 at 6:37

GoogleCodeExporter commented 8 years ago
  fixed in rev 35.

Original comment by mats.cro...@gmail.com on 20 Jul 2007 at 11:03