pluginNameOfFilename

Returns the name of a plugin based on its filename.

This is preferred over slicing std.path.baseName because some plugins are nested in their own directories. The basename of plugins/twitch/base.d is base.d, much like that of plugins/printer/base.d is.

With this we get twitch and printer instead, while still getting oneliners.

pluginNameOfFilename
(
const string filename
)

Parameters

filename string

Full path to a plugin file.

Return Value

Type: auto

The name of the plugin, based on its filename.

Examples

{
    version(Posix) enum filename = "plugins/oneliners.d";
    else /*version(Windows)*/ enum filename = "plugins\\oneliners.d";
    immutable expected = "oneliners";
    immutable actual = pluginNameOfFilename(filename);
    assert((expected == actual), actual);
}
{
    version(Posix) enum filename = "plugins/twitch/base.d";
    else /*version(Windows)*/ enum filename = "plugins\\twitch\\base.d";
    immutable expected = "twitch";
    immutable actual = pluginNameOfFilename(filename);
    assert((expected == actual), actual);
}
{
    version(Posix) enum filename = "plugins/counters.d";
    else /*version(Windows)*/ enum filename = "plugins\\counters.d";
    immutable expected = "counters";
    immutable actual = pluginNameOfFilename(filename);
    assert((expected == actual), actual);
}