suggestModuleName

Suggest a module name from the paths and the filename

@safe
string
suggestModuleName
(
string filename
,
const(string)[] paths
)

Parameters

paths const(string)[]

list of search paths

filename string

name of the file to be mapped to module name

Return Value

Type: string

return a suggestion of a module name

Examples

Example: suggestModuleName

auto paths = [
    buildPath(["some", "path", "to", "modules"]),
    buildPath(["another", "path", "to"])
];
const filename = buildPath(["another", "path", "to", "some", "module", "path", "ModuleName"])
    .setExtension(FileExtension.dsrc);
assert(filename.suggestModuleName(paths) == "some.module.path.ModuleName");