Commits

Arjan Scherpenisse committed fe07021

Fix lib tag for including multiple files directly from the toplevel 'lib' folder.

Fixes issue 143

  • Participants
  • Parent commits 7d2bb8c

Comments (0)

Files changed (2)

src/support/tests/z_lib_include_tests.erl

                  z_lib_include:uncollapse("/a/b1~b2~b/c~/a/b3~63415422477.js")),
     ?assertEqual(["/a/b1.js"],
                  z_lib_include:uncollapse("/a/b1~63415422477.js")),
+    ?assertEqual(["/a1.js","/a2.js"],
+                 z_lib_include:uncollapse("/a1~a2~63415422477.js")),
     ok.
 
 

src/support/z_lib_include.erl

     uncollapse_dirs([]) ->
         [];
     uncollapse_dirs([File|Rest]) ->
-        uncollapse_dirs(Rest, filename:dirname(File), [File]).
-        
+        case filename:dirname(File) of
+            [X] when X =:= $. orelse X =:= $/ ->
+                uncollapse_dirs(Rest, [], [File]);
+            N ->
+                uncollapse_dirs(Rest, N, [File])
+        end.
+
         uncollapse_dirs([], _Dirname, Acc) ->
             Acc;
         uncollapse_dirs([[$/|_]=File|Rest], _Dirname, Acc) ->