Last Comment Bug 681660 - [win] GetDiskSpaceAvailable doesn't work on files
: [win] GetDiskSpaceAvailable doesn't work on files
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All Windows 7
-- normal (vote)
: mozilla9
Assigned To: Marco Bonardo [::mak]
: Nathan Froyd [:froydnj]
Depends on:
Blocks: 666611 674210
  Show dependency treegraph
Reported: 2011-08-24 08:44 PDT by Marco Bonardo [::mak]
Modified: 2015-12-04 01:42 PST (History)
3 users (show)
mak77: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch v1.0 (2.44 KB, patch)
2011-08-24 16:06 PDT, Marco Bonardo [::mak]
jmathies: review+
Details | Diff | Splinter Review

Description User image Marco Bonardo [::mak] 2011-08-24 08:44:07 PDT
This works:
Components.utils.import("resource://gre/modules/Services.jsm"); var profile = Services.dirsvc.get("ProfD", Components.interfaces.nsILocalFile); profile.diskSpaceAvailable;

This returns 0:
Components.utils.import("resource://gre/modules/Services.jsm"); var file = Services.dirsvc.get("ProfD", Components.interfaces.nsILocalFile); file.append("places.sqlite"); file.diskSpaceAvailable;

It returns 0 because GetDiskFreeSpaceExW returns 0 (thus it fails)
Comment 1 User image Marco Bonardo [::mak] 2011-08-24 08:49:29 PDT
and that is not so wrong since the first argument to GetDiskFreeSpaceExW is lpDirectoryName... it must be a directory, probably if the nsILocalFile is a file we should rather query its parent directory
Comment 2 User image Marco Bonardo [::mak] 2011-08-24 08:51:27 PDT
tentatively taking
Comment 3 User image Marco Bonardo [::mak] 2011-08-24 16:06:35 PDT
Created attachment 555580 [details] [diff] [review]
patch v1.0
Comment 5 User image Matt Brubeck (:mbrubeck) 2011-08-26 09:25:22 PDT

Note You need to log in before you can comment on or make changes to this bug.