diff --git phobos/std/path.d phobos/std/path.d index a8abd2b..c81866c 100644 --- phobos/std/path.d +++ phobos/std/path.d @@ -41,35 +41,35 @@ version(Windows) /** String used to separate directory names in a path. Under * Windows this is a backslash, under Linux a slash. */ - immutable char[1] sep = "\\"; + enum sep = "\\"; /** Alternate version of sep[] used in Windows (a slash). Under * Linux this is empty. */ - immutable char[1] altsep = "/"; + enum altsep = "/"; /** Path separator string. A semi colon under Windows, a colon * under Linux. */ - immutable char[1] pathsep = ";"; + enum pathsep = ";"; /** String used to separate lines, \r\n under Windows and \n * under Linux. */ - immutable char[2] linesep = "\r\n"; /// String used to separate lines. - immutable char[1] curdir = "."; /// String representing the current directory. - immutable char[2] pardir = ".."; /// String representing the parent directory. + enum linesep = "\r\n"; /// String used to separate lines. + enum curdir = "."; /// String representing the current directory. + enum pardir = ".."; /// String representing the parent directory. } version(Posix) { /** String used to separate directory names in a path. Under * Windows this is a backslash, under Linux a slash. */ - immutable char[1] sep = "/"; + enum sep = "/"; /** Alternate version of sep[] used in Windows (a slash). Under * Linux this is empty. */ - immutable char[0] altsep; + enum altsep = ""; /** Path separator string. A semi colon under Windows, a colon * under Linux. */ - immutable char[1] pathsep = ":"; + enum pathsep = ":"; /** String used to separate lines, \r\n under Windows and \n * under Linux. */ - immutable char[1] linesep = "\n"; - immutable char[1] curdir = "."; /// String representing the current directory. - immutable char[2] pardir = ".."; /// String representing the parent directory. + enum linesep = "\n"; + enum curdir = "."; /// String representing the current directory. + enum pardir = ".."; /// String representing the parent directory. } /***************************** @@ -395,12 +395,14 @@ unittest String dirname(String)(String fullname) if (isSomeString!(String)) { + alias Unqual!(immutable String) ImmString; Unqual!String s = fullname; version (Posix) { - enum immutable(String) sep = .sep, - curdir = .curdir; + enum ImmString sep = .sep; + enum ImmString curdir = .curdir; + for (; !s.empty; s.popBack) { if (s.endsWith(sep)) @@ -416,10 +418,11 @@ String dirname(String)(String fullname) } else version (Windows) { - enum immutable(String) sep = .sep, - altsep = .altsep, - curdir = .curdir, - drvsep = ":"; + enum ImmString sep = .sep; + enum ImmString altsep = .altsep; + enum ImmString curdir = .curdir; + enum ImmString drvsep = ":"; + bool foundSep; for (; !s.empty; s.popBack) {