Finds the source filename and compiler options for a module.
The result can be fed to
compile:file/2 to compile the file again.
Warning
This function is deprecated. Use
filelib:find_source/1 instead for finding source files.
If possible, use the beam_lib(3)
module to extract the compiler options and the abstract code
format from the Beam file and compile that instead.
Argument Beam, which can be a string or an atom,
specifies either the module name or the path to the source
code, with or without extension ".erl". In either
case, the module must be known by the code server, that is,
code:which(Module) must succeed.
Rules describes how the source directory can be
found when the object code directory is known. It is a list of
tuples {BinSuffix, SourceSuffix} and
is interpreted as follows: if the end of the directory name where the
object is located matches BinSuffix, then the
name created by replacing BinSuffix with
SourceSuffix is expanded by calling
filelib:wildcard/1.
If a regular file is found among the matches, the function
returns that location together with Options.
Otherwise the next rule is tried, and so on.
Rules defaults
to:
[{"", ""}, {"ebin", "src"}, {"ebin", "esrc"},
{"ebin", "src/*"}, {"ebin", "esrc/*"}]
The function returns {SourceFile,
Options} if it succeeds.
SourceFile is the absolute path to the source
file without extension ".erl". Options
includes the options that are necessary to recompile the file with
compile:file/2, but excludes options such as report
and verbose, which do not change the way code is generated.
The paths in options {outdir, Path} and
{i, Path} are guaranteed to be absolute.