Hi Frank,


Having a look at http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?view=markup

I find the following issues:
- FileSystemUtils.getFreeSpaceWindows() will only work on English Windows versions
because of the dependency on finding the "bytes free" string in
int bfl = line.indexOf("bytes free");
You can probably cover a larger set of international versions (although probably not all)
just by keeping the last line with text and find its last continuous segment of digits.


 - Then , the Unix version starts like this:
   private static long getFreeSpaceUnix(String path) throws IOException {
       // build and run the 'dir' command
       String[] cmdAttrbs = new String[3];
       cmdAttrbs[0] = "cmd.exe";
       cmdAttrbs[1] = "/C";
       cmdAttrbs[2] = "df " + path;

I am no big Unix expert, but you rely on an "cmd.exe" on Unix?????
(A friend of mine that uses Linux quite often expressed some doubts about this too!)


   I thought that on Unix "df" is an executable you can directly call!
   Since I am no Unix expert, could you please enlighten me.


Anyway, the code looks like a stab on the right direction.


Regards, Paulo Gaspar


Frank W. Zammetti wrote:

> Ah, that would explain much :) Thank you Niall!
>
> (P.S., I was only asking about this because someone else sent me a private eMail asking where it was... they remembered seeing discussion of it some time ago and thought it would be perfect for their needs... otherwise I wouldn't have noticed)
>
> Frank
>
> Niall Pemberton wrote:
>
>> Frank,
>>
>> The whole of commons has moved from CVS to SVN - your FileSystemUtils class
>> is in SVN:
>>
>> http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/io/trunk/
>>
>> Niall
>>
>> ----- Original Message ----- From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
>> Sent: Thursday, May 05, 2005 4:19 AM
>>
>>
>>
>>> It looks like the FileSystemUtils class I wrote that contained the
>>> method to get free space on a volume in a cross-platform manner has been
>>> removed... Or am I just missing it? It the later, please point me at it
>>> because I'm not seeing it in CVS... If the former though, who removed it
>>> and why?
>>
>>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to