Setup for not using fsutil.exe which is probably going to rain a stash of User Action Control dialogs on vista, and has internationalized messages so fails to parse correctly on any non-english windows install.

This commit is contained in:
Reinier Zwitserloot committed 2009-07-23 21:28:43 +02:00
1 parent 441e371efe
commit 8bd4da7fdd
1 file changed
+29
@@ -0,0 +1,29 @@
package lombok.installer;
import java.util.ArrayList;
import java.util.List;
public class WindowsDriveInfo {
public List<String> getLogicalDrives() {
int flags = getLogicalDrives0();
flags = (flags & 0xFF) << 24 |
((flags >> 8) & 0xFF) << 16 |
((flags >> 16) & 0xFF) << 8 |
(flags >> 24) & 0xFF;
List<String> letters = new ArrayList<String>();
for ( int i = 0 ; i < 26 ; i++ ) {
if ( (flags & (1 << i)) != 0 ) letters.add(Character.toString((char)('A' + i)));
}
return letters;
}
private native int getLogicalDrives0();
public boolean isFixedDisk(String letter) {
return getDriveType(letter.toUpperCase() + ":\\") == 3L;
}
private native int getDriveType(String name);
}