diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-23 21:28:43 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-23 21:28:43 +0200 |
commit | 8bd4da7fdd4e8e74f8d388961ea0853de3c9a215 (patch) | |
tree | a06f4821aa87b2bb6ae0c977e2cb865838f321d9 /src/lombok/installer/WindowsDriveInfo.java | |
parent | 441e371efe6b18f2aa1565ef23bc6cdfe3c9ecf5 (diff) | |
download | lombok-8bd4da7fdd4e8e74f8d388961ea0853de3c9a215.tar.gz lombok-8bd4da7fdd4e8e74f8d388961ea0853de3c9a215.tar.bz2 lombok-8bd4da7fdd4e8e74f8d388961ea0853de3c9a215.zip |
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.
Diffstat (limited to 'src/lombok/installer/WindowsDriveInfo.java')
-rw-r--r-- | src/lombok/installer/WindowsDriveInfo.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lombok/installer/WindowsDriveInfo.java b/src/lombok/installer/WindowsDriveInfo.java new file mode 100644 index 00000000..4689e535 --- /dev/null +++ b/src/lombok/installer/WindowsDriveInfo.java @@ -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); +} |