bug 148704: directories should always return PR_TRUE from IsWritable(), r=darin sr=dougt

This commit is contained in:
brofield%jellycan.com 2004-07-29 23:25:32 +00:00
parent 14456163f2
commit 4221b9c089

View File

@ -1792,14 +1792,24 @@ nsLocalFile::Exists(PRBool *_retval)
}
NS_IMETHODIMP
nsLocalFile::IsWritable(PRBool *_retval)
nsLocalFile::IsWritable(PRBool *aIsWritable)
{
nsresult rv = HasFileAttribute(FILE_ATTRIBUTE_READONLY, _retval);
//TODO: extend to support NTFS file permissions
// The read-only attribute on a FAT directory only means that it can't
// be deleted. It is still possible to modify the contents of the directory.
nsresult rv = IsDirectory(aIsWritable);
if (NS_FAILED(rv))
return rv;
if (*aIsWritable)
return NS_OK;
// writable if the file doesn't have the readonly attribute
rv = HasFileAttribute(FILE_ATTRIBUTE_READONLY, aIsWritable);
if (NS_FAILED(rv))
return rv;
*aIsWritable = !*aIsWritable;
// writable if it doesn't have the readonly attribute
*_retval = !*_retval;
return NS_OK;
}