diff --git a/platform.d b/platform.d index b207155..79bce1f 100644 --- a/platform.d +++ b/platform.d @@ -475,7 +475,7 @@ ExecLocation(T)() } auto -Cwd(T)() +Cwd(T = string)() { static char[512] buf; @@ -487,7 +487,7 @@ Cwd(T)() } else static if(is(T: string)) { - return ConvToStr(buf)[0 .. strlen(buf.ptr)]; + return ConvToStr(buf[0 .. strlen(buf.ptr)]); } } diff --git a/util.d b/util.d index 40c17e9..d93cfd5 100644 --- a/util.d +++ b/util.d @@ -14,7 +14,7 @@ import std.traits; import core.stdc.string : memset; import core.simd; -enum bool StringType(T) = (is(T: string) || is(T: u8[]) || is(T: char[])); +enum bool StringType(T) = (is(T: string) || is(T: u8[]) || is(T: char[]) || is(T: const(char)[])); pragma(inline) void Int3() @@ -45,7 +45,7 @@ Assert(T)(T cond, string msg) } string -Str(T)(T[] arr) +Str(T)(T arr) if(StringType!(T)) { return (cast(immutable(char)*)arr.ptr)[0 .. arr.length]; }