digitalmars.D.bugs - [Issue 10348] New: isRooted is either wrong or poorly specified
- d-bugmail puremagic.com (49/49) Jun 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (7/7) Jun 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (21/21) Jul 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (28/30) Jul 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (7/7) Jul 31 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (8/8) Aug 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
- d-bugmail puremagic.com (9/9) Aug 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10348
http://d.puremagic.com/issues/show_bug.cgi?id=10348 Summary: isRooted is either wrong or poorly specified Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 18:19:15 PDT --- ----- import std.path; void main() { assert(!isAbsolute(r"\")); // ok assert(!isRooted(r"\")); // fails, path is rooted } ----- How can a non-absolute path be rooted? It doesn't make sense to me that r"\" itself is rooted (where is it rooted? which drive or network drive?). It's not a valid path on Windows. Another example: ----- import std.path; void main() { assert(!isAbsolute(r"\")); // ok assert(absolutePath(r"\") != r"\"); // fails, it returned r"\" } ----- So if r"\" is not an absolute path, how can the absolute path of r"\" be r"\" when it's not absolute? The docs for isRooted state: "Determines whether a path starts at a root directory." So in that case absolutePath() should have no problem creating an absolute path of such a rooted path. But you can't create an absolute path out of r"\". r"\" is not rooted anywhere. I think isRooted should have these tests: assert (!isRooted(`\`)); // changed assert (!isRooted(`\foo`)); // changed assert (isRooted(`d:\foo`)); assert (isRooted(`\\foo\bar`)); assert (!isRooted("foo")); assert (!isRooted("d:foo")); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 12 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 PDT --- properly defined. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 12 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |bugzilla kyllingen.net AssignedTo|nobody puremagic.com |bugzilla kyllingen.net 08:59:24 PDT --- Surely \ is a valid path on Windows. Just open cmd.exe and run dir \ and it will list the files in the root directory of the current drive. I agree that absoluteDir(`\`) returns a wrong result. It should probably return rootName(base) instead. I'll take care of it. Whether isRooted(`\`) should be true or false is just a matter of definition. `\` refers to the *root directory* of the current drive, so it made sense to me to define it as true. Redefining it now would be a breaking change. If you think it is worth it, it should at least be brought up for community discussion first. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 13:24:17 PDT ---I agree that absoluteDir(`\`) returns a wrong result. It should probably return rootName(base) instead. I'll take care of it..net seems to return the drive path, e.g.: ----- using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string path1 = "\\"; string fullPath; fullPath = Path.GetFullPath(path1); Console.WriteLine("GetFullPath('{0}') returns '{1}'", path1, fullPath); } } } ----- Prints: GetFullPath('\') returns 'c:\' So I guess only 'absolutePath' needs to be fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 10:42:18 PDT --- Pull request 1442 coincidentally fixes this bug. https://github.com/D-Programming-Language/phobos/pull/1442 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/23a1fe9ae0c31efce5acad379f59117063738c29 Added unittests for issue 10348 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 06 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10348 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 06 2013