49 lines
1.8 KiB
Java
49 lines
1.8 KiB
Java
package lombok.installer;
|
|
|
|
import java.io.PrintStream;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
/* loaded from: com.discord-121110.apk:lombok/installer/WindowsDriveInfo.SCL.lombok */
|
|
public class WindowsDriveInfo {
|
|
public List<String> getLogicalDrives() {
|
|
int logicalDrives0 = getLogicalDrives0();
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i = 0; i < 26; i++) {
|
|
if ((logicalDrives0 & (1 << i)) != 0) {
|
|
arrayList.add(Character.toString((char) (65 + i)));
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private native int getLogicalDrives0();
|
|
|
|
public boolean isFixedDisk(String str) {
|
|
if (str.length() != 1) {
|
|
throw new IllegalArgumentException("Supply 1 letter, not: " + str);
|
|
}
|
|
char upperCase = Character.toUpperCase(str.charAt(0));
|
|
if (upperCase >= 'A' && upperCase <= 'Z') {
|
|
return ((long) getDriveType(new StringBuilder(String.valueOf(upperCase)).append(":\\").toString())) == 3;
|
|
}
|
|
throw new IllegalArgumentException("A drive is indicated by a letter, so A-Z inclusive. Not " + upperCase);
|
|
}
|
|
|
|
private native int getDriveType(String str);
|
|
|
|
public static void main(String[] strArr) {
|
|
System.loadLibrary("WindowsDriveInfo");
|
|
WindowsDriveInfo windowsDriveInfo = new WindowsDriveInfo();
|
|
Iterator<String> it = windowsDriveInfo.getLogicalDrives().iterator();
|
|
while (it.hasNext()) {
|
|
String next = it.next();
|
|
PrintStream printStream = System.out;
|
|
Object[] objArr = new Object[2];
|
|
objArr[0] = next;
|
|
objArr[1] = windowsDriveInfo.isFixedDisk(next) ? "Fixed Disk" : "Not Fixed Disk";
|
|
printStream.printf("Drive %s: - %s\n", objArr);
|
|
}
|
|
}
|
|
}
|