Browse Source

filetype/1 fix

Compaction of code
Andy 11 years ago
parent
commit
cfddf43bc9
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/mad_compile.erl

+ 1 - 3
src/mad_compile.erl

@@ -69,9 +69,7 @@ validate_property(Else, _) -> Else.
     fun((file:name(),string(),string(),list(tuple(any(),any())),string()) -> ok).
     fun((file:name(),string(),string(),list(tuple(any(),any())),string()) -> ok).
 compile_fun(Inc,Bin,Opt) -> fun(File) -> compile(File,Inc,Bin,Opt,filetype(File)) end.
 compile_fun(Inc,Bin,Opt) -> fun(File) -> compile(File,Inc,Bin,Opt,filetype(File)) end.
 
 
-filetype(Path) ->
-    File = filename:basename(Path),
-    L=length(hd(string:tokens(File,"."))), string:substr(File, L + 1, length(File)).
+filetype(Path) -> "." ++ string:join(tl(string:tokens(filename:basename(Path), ".")), ".").
 
 
 compile(File,Inc,Bin,Opt,".yrl") ->
 compile(File,Inc,Bin,Opt,".yrl") ->
     ErlFile = yrl_to_erl(File),
     ErlFile = yrl_to_erl(File),