Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions std/path.d
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ version (StdUnittest)
private:
struct TestAliasedString
{
string get() @safe @nogc pure nothrow { return _s; }
string get() @safe @nogc pure nothrow return scope { return _s; }
alias get this;
@disable this(this);
string _s;
}

bool testAliasedString(alias func, Args...)(string s, Args args)
bool testAliasedString(alias func, Args...)(scope string s, scope Args args)
{
return func(TestAliasedString(s), args) == func(s, args);
}
Expand Down Expand Up @@ -406,22 +406,22 @@ else static assert(0);
the POSIX requirements for the 'basename' shell utility)
(with suitable adaptations for Windows paths).
*/
auto baseName(R)(R path)
auto baseName(R)(return scope R path)
if (isRandomAccessRange!R && hasSlicing!R && isSomeChar!(ElementType!R) && !isSomeString!R)
{
return _baseName(path);
}

/// ditto
auto baseName(C)(C[] path)
auto baseName(C)(return scope C[] path)
if (isSomeChar!C)
{
return _baseName(path);
}

/// ditto
inout(C)[] baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)
(inout(C)[] path, in C1[] suffix)
(return scope inout(C)[] path, in C1[] suffix)
@safe pure //TODO: nothrow (because of filenameCmp())
if (isSomeChar!C && isSomeChar!C1)
{
Expand Down Expand Up @@ -522,7 +522,7 @@ if (isSomeChar!C && isSomeChar!C1)
assert(sa.baseName == "test");
}

private R _baseName(R)(R path)
private R _baseName(R)(return scope R path)
if (isRandomAccessRange!R && hasSlicing!R && isSomeChar!(ElementType!R) || isNarrowString!R)
{
auto p1 = stripDrive(path);
Expand Down Expand Up @@ -1910,7 +1910,7 @@ if (isSomeChar!C)
normalized path as a forward range
*/

auto asNormalizedPath(R)(R path)
auto asNormalizedPath(R)(return scope R path)
if (isSomeChar!(ElementEncodingType!R) &&
(isRandomAccessRange!R && hasSlicing!R && hasLength!R || isNarrowString!R) &&
!isConvertibleToString!R)
Expand Down Expand Up @@ -2077,7 +2077,7 @@ if (isSomeChar!(ElementEncodingType!R) &&
}
}

auto asNormalizedPath(R)(auto ref R path)
auto asNormalizedPath(R)(return scope auto ref R path)
if (isConvertibleToString!R)
{
return asNormalizedPath!(StringTypeOf!R)(path);
Expand Down