Closed
Bug 10260
Opened 25 years ago
Closed 25 years ago
Add ability to see if a file/folder is "hidden" via nsFileSpec
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
People
(Reporter: mozilla, Assigned: dougt)
References
Details
nsFileSpec needs an additional cross-platform method that can indicate whether a
file/folder is "hidden" or not. That might mean different things depending upon
the platform. On Mac, it just means checking the items "hidden" bit in the
fileInfo struct. For Unix, hidden should probably mean that the file/directory
name started with a period. For Windows, the DOS HIDDEN attribute should be
checked.
Take a look at mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp and look for
the isVisible() function around line #872.As mentioned, the code needs to be
changed so that under Win98/WinNT it does the right thing of checking the Hidden
attribute, which it currently doesn't do.
Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 1•25 years ago
|
||
Ok. I added your code and added a windows function. I have sent mail the the
Be and OS developers. I am not sure how they want to handle this. I was
tempted to just use the unix implementation, but you never know if this would
break for them. I will be checking in today. If you want a head start, here
are the diffs:
Index: nsFileSpec.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpec.h,v
retrieving revision 1.40
diff -r1.40 nsFileSpec.h
458a459,460
> PRBool IsHidden() const;
>
Index: nsFileSpecBeOS.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecBeOS.cpp,v
retrieving revision 1.2
diff -r1.2 nsFileSpecBeOS.cpp
117a118,124
> PRBool nsFileSpec::IsHidden() const
>
//------------------------------------------------------------------------------
----------
> {
> return PR_FALSE; // FIX!!!!!
> } // nsFileSpec::IsHidden
>
>
//------------------------------------------------------------------------------
----------
Index: nsFileSpecImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecImpl.cpp,v
retrieving revision 3.17
diff -r3.17 nsFileSpecImpl.cpp
303a304,312
> NS_IMETHODIMP nsFileSpecImpl::isHidden(PRBool *_retval)
>
//------------------------------------------------------------------------------
----------
> {
> TEST_OUT_PTR(_retval)
> *_retval = mFileSpec.IsHidden();
> return mFileSpec.Error();
> }
>
>
//------------------------------------------------------------------------------
----------
Index: nsFileSpecImpl.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecImpl.h,v
retrieving revision 1.7
diff -r1.7 nsFileSpecImpl.h
90a91,93
>
> /* boolean isHidden (); */
> NS_IMETHOD isHidden(PRBool *_retval);
Index: nsFileSpecMac.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecMac.cpp,v
retrieving revision 1.28
diff -r1.28 nsFileSpecMac.cpp
824a825,838
> PRBool nsFileSpec::IsHidden() const
>
//------------------------------------------------------------------------------
----------
> {
> CInfoPBRec cInfo;
> PRBool hidden = PR_FALSE;
>
> if (noErr = GetCatInfo(cInfo))
> if (cInfo.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible)
> hidden = PR_TRUE;
>
> return hidden;
> } // nsFileSpec::IsHidden
>
>
//------------------------------------------------------------------------------
----------
Index: nsFileSpecOS2.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecOS2.cpp,v
retrieving revision 1.1
diff -r1.1 nsFileSpecOS2.cpp
196a197,201
> PRBool nsFileSpec::IsHidden() const
> {
> return PR_FALSE; // FIX!
> }
>
Index: nsFileSpecUnix.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecUnix.cpp,v
retrieving revision 1.36
diff -r1.36 nsFileSpecUnix.cpp
181a182,198
> PRBool nsFileSpec::IsHidden() const
>
//------------------------------------------------------------------------------
----------
> {
> PRBool hidden = PR_TRUE;
> char *leafname = GetLeafName();
> if (nsnull != leafname)
> {
> if ((!strcmp(leafname, ".")) || (!strcmp(leafname, "..")))
> {
> hidden = PR_FALSE;
> }
> nsCRT::free(leafname);
> }
> return hidden;
> } // nsFileSpec::IsHidden
>
>
//------------------------------------------------------------------------------
----------
Index: nsFileSpecWin.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecWin.cpp,v
retrieving revision 1.32
diff -r1.32 nsFileSpecWin.cpp
223a224,238
> PRBool nsFileSpec::IsHidden() const
>
//------------------------------------------------------------------------------
----------
> {
> PRBool hidden = PR_FALSE;
> if (!mPath.IsEmpty())
> {
> DWORD attr = GetFileAttributes(mPath);
> if (FILE_ATTRIBUTE_HIDDEN & attr)
> hidden = PR_TRUE;
> }
> return hidden;
> }
> // nsFileSpec::IsHidden
>
>
//------------------------------------------------------------------------------
----------
Index: nsIFileSpec.idl
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsIFileSpec.idl,v
retrieving revision 3.12
diff -r3.12 nsIFileSpec.idl
84a85
> boolean isHidden();
Comment 2•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
•