Full path to a plugin file.
A meaningful basename of the passed filename.
{ version(Posix) enum filename = "plugins/oneliners.d"; else /*version(Windows)*/ enum filename = "plugins\\oneliners.d"; immutable expected = "oneliners.d"; immutable actual = pluginFileBaseName(filename); assert((expected == actual), actual); } { version(Posix) { enum filename = "plugins/twitch/base.d"; immutable expected = "twitch/base.d"; } else /*version(Windows)*/ { enum filename = "plugins\\twitch\\base.d"; immutable expected = "twitch\\base.d"; } immutable actual = pluginFileBaseName(filename); assert((expected == actual), actual); } { version(Posix) enum filename = "plugins/counters.d"; else /*version(Windows)*/ enum filename = "plugins\\counters.d"; immutable expected = "counters.d"; immutable actual = pluginFileBaseName(filename); assert((expected == actual), actual); }
Returns a meaningful basename of a plugin filename.
This is preferred over use of 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/base.d and printer/base.d instead, while still getting oneliners.d.