Skip to content

Commit

Permalink
Merge pull request #11063 from kinke/filename
Browse files Browse the repository at this point in the history
[stable] dmd.root.filename: Restore C++ absolute() / ext() versions
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Apr 26, 2020
2 parents abf2b56 + f328221 commit 8b52f1d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/dmd/root/filename.d
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ nothrow:
* Returns:
* true if absolute path name.
*/
extern (C++) static bool absolute(const(char)* name) pure @nogc
{
return absolute(name.toDString);
}

/// Ditto
extern (D) static bool absolute(const(char)[] name) pure @nogc
{
if (!name.length)
Expand Down Expand Up @@ -145,6 +151,12 @@ nothrow:
* Points past '.' of extension.
* If there isn't one, return null.
*/
extern (C++) static const(char)* ext(const(char)* str) pure @nogc
{
return ext(str.toDString).ptr;
}

/// Ditto
extern (D) static const(char)[] ext(const(char)[] str) nothrow pure @safe @nogc
{
foreach_reverse (idx, char e; str)
Expand Down

0 comments on commit 8b52f1d

Please sign in to comment.