fix for bug: 10260
removed warning in nsIFileStream.cpp
This commit is contained in:
Родитель
8b5a7062e6
Коммит
944676615b
|
@ -456,6 +456,8 @@ class NS_COM nsFileSpec
|
|||
// More stringent than Exists()
|
||||
PRBool Exists() const;
|
||||
|
||||
PRBool IsHidden() const;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Creation and deletion of objects. These can modify the disk.
|
||||
//--------------------------------------------------
|
||||
|
|
|
@ -114,6 +114,13 @@ PRBool nsFileSpec::IsDirectory() const
|
|||
return !mPath.IsEmpty() && 0 == stat(mPath, &st) && S_ISDIR(st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsHidden() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return PR_FALSE; // FIX!!!!!
|
||||
} // nsFileSpec::IsHidden
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -300,6 +300,15 @@ NS_IMETHODIMP nsFileSpecImpl::exists(PRBool *_retval)
|
|||
return mFileSpec.Error();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsFileSpecImpl::isHidden(PRBool *_retval)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
TEST_OUT_PTR(_retval)
|
||||
*_retval = mFileSpec.IsHidden();
|
||||
return mFileSpec.Error();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsFileSpecImpl::GetFileSize(PRUint32 *aFileSize)
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -88,6 +88,9 @@ class NS_COM nsFileSpecImpl
|
|||
|
||||
/* boolean exists (); */
|
||||
NS_IMETHOD exists(PRBool *_retval);
|
||||
|
||||
/* boolean isHidden (); */
|
||||
NS_IMETHOD isHidden(PRBool *_retval);
|
||||
|
||||
/* readonly attribute unsigned long FileSize; */
|
||||
NS_IMETHOD GetFileSize(PRUint32 *aFileSize);
|
||||
|
|
|
@ -821,6 +821,20 @@ PRBool nsFileSpec::IsDirectory() const
|
|||
return (noErr == FSpGetDirectoryID(&mSpec, &dirID, &isDirectory) && isDirectory);
|
||||
} // nsFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -194,6 +194,11 @@ PRBool nsFileSpec::IsDirectory() const
|
|||
return (0 == stat( mPath, &st)) && (S_IFDIR == (st.st_mode & S_IFDIR));
|
||||
}
|
||||
|
||||
PRBool nsFileSpec::IsHidden() const
|
||||
{
|
||||
return PR_FALSE; // FIX!
|
||||
}
|
||||
|
||||
void nsFileSpec::GetModDate( TimeStamp& outStamp) const
|
||||
{
|
||||
struct stat st;
|
||||
|
|
|
@ -178,6 +178,23 @@ PRBool nsFileSpec::IsDirectory() const
|
|||
return !mPath.IsEmpty() && 0 == stat(mPath, &st) && S_ISDIR(st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -220,6 +220,21 @@ PRBool nsFileSpec::IsDirectory() const
|
|||
return !mPath.IsEmpty() && 0 == stat(nsNSPRPath(*this), &st) && (_S_IFDIR & st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -82,6 +82,7 @@ interface nsIFileSpec : nsISupports
|
|||
boolean isDirectory();
|
||||
boolean isFile();
|
||||
boolean exists();
|
||||
boolean isHidden();
|
||||
|
||||
readonly attribute unsigned long FileSize;
|
||||
readonly attribute unsigned long DiskSpaceAvailable;
|
||||
|
|
|
@ -387,10 +387,10 @@ NS_IMETHODIMP FileImpl::Flush()
|
|||
#endif
|
||||
if (!mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
PRBool itFailed = PR_Sync(mFileDesc) != PR_SUCCESS;
|
||||
|
||||
#ifdef XP_MAC
|
||||
// On unix, it seems to fail always.
|
||||
if (itFailed)
|
||||
if (PR_Sync(mFileDesc) != PR_SUCCESS)
|
||||
mFailed = PR_TRUE;
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче