Closed
Bug 5300
Opened 26 years ago
Closed 26 years ago
DOS drives (at root level) fail when asked IsDirectory()
Categories
(Core :: XPCOM, defect, P2)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mozilla, Assigned: dougt)
Details
Given a URL to the root of a DOS drive such as "file:///S|/", the following
code fails:
nsFileURL fileURL(url);
nsFileSpec fileSpec(fileURL);
if (fileSpec.IsDirectory())
{
// due to this bug, code inside here will never be reached
}
QA: To test, run apprunner, load in "resource:/res/rdf/sidebar.xul" and open the
"File System" container. You'll see a list of available drives. However, due to
this bug you won't be able to double-click on any of the drives to see its
contents.
Reporter | ||
Updated•26 years ago
|
Priority: P3 → P2
Reassigning to dougt, who did the windows implementation, I think. The
implementation uses this code:
return 0 == stat(nsprPath(*this), &st) && (_S_IFDIR & st.st_mode);
Looking at the windows documentation, I see that _S_IFDIR is not set for a
device, _S_IFREG is set instead. David Bienvenu suggested that I could explicitly
look for a trailing slash in that case.
I'm wondering, though, did the URL really have the trailing slash as you assert?
If not, even this hack will not change the behavior.
Note that on windows, C: represents the cwd on C, and C:/ represents the root
directory.
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•26 years ago
|
||
It is a bug in nsprPath on windows. I am removing the trailing slash without
checking if there is a colon preceding it. This trailing slash should never be
removed if it is in front of a colon.
I fixed it, and will check it in as soon as possible.
Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 3•26 years ago
|
||
Checking in now. Here is the diff for those interested:
Index: nsFileSpec.cpp
===================================================================
RCS file: /cvsroot/mozilla/base/src/nsFileSpec.cpp,v
retrieving revision 1.43
diff -c -4 -r1.43 nsFileSpec.cpp
*** nsFileSpec.cpp 1999/04/20 19:09:22 1.43
--- nsFileSpec.cpp 1999/04/23 06:30:38
***************
*** 1179,1189 ****
/* Replace the bar */
if(resultPath[1] == '|')
resultPath[1] = ':';
! /* Remove the ending seperator */
! if(resultPath[PL_strlen(resultPath) - 1 ] == '/')
! resultPath[PL_strlen(resultPath) - 1 ] = '\0';
return resultPath;
#else
--- 1179,1191 ----
/* Replace the bar */
if(resultPath[1] == '|')
resultPath[1] = ':';
! /* Remove the ending seperator only if it is not the last seperator*/
! int len = PL_strlen(resultPath);
! if(resultPath[len - 1 ] == '/')
! if(resultPath[len - 2 ] != ':')
! resultPath[len - 1 ] = '\0';
return resultPath;
#else
Comment 4•25 years ago
|
||
Bulk moving to XPCOM, in preparation for removal of XP File Handling component.
(XPFH has received two bugs in ~5 months, and is no longer in active use.)
Component: XP File Handling → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•