Re: GetDiskSpaceAvailable in Linux

Wan-Teh Chang <[email protected]>
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
Vineeth wrote:
> Hi,
> 
> I want to check the available space on the disk......
> this is how i am doing it............
> 
> 
> PRInt64 iSize = 0;
> nsCOMPtr<nsILocalFile> mFile;
> NS_NewLocalFile (path, PR_TRUE, getter_AddRefs (mFile));
> mFile->GetDiskSpaceAvailable(&iSize);
> 
> 
> I get the correct values on Windows......but on the linux the
> available disk space i get is 0.
> Can anyone help me on this.......

nsILocalFile is an XPCOM interface.  Please ask this question
in the xpcom newsgroup/mailing list.  You can find it by
searching for "xpcom" in this page:
http://www.mozilla.org/community/developer-forums.html

The Unix/Linux implementation of GetDiskSpaceAvailable is here:
http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsLocalFileUnix.cpp#1144

Since Linux has both <sys/statfs.h> and <sys/statvfs.h>, it seems
that this method is implemented.  I suspect that the call failed.
Check the return value of mFile->GetDiskSpaceAvailable(&iSize).
Does it return NS_ERROR_FAILURE or NS_OK?  If it returns
NS_ERROR_FAILURE, what's the value of 'errno'?

Wan-Teh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.