I try to list root directories with Groovy. There I only get local hard drives. The same statement in Java return local hard drives and all network drives. Anyone have an idea why Groovy behaves differently?
Working with:
- Groovy Version: 4.0.4 JVM: 1.8.0_151 Vendor: Oracle Corporation OS: Windows 10
- java version "1.8.0_151"
Groovy:
for (File root : File.listRoots()) {
System.out.println(root);
}
Output:
B:\
C:\
E:\
Java:
import java.io.File;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
for (File root : File.listRoots()) {
System.out.println(root);
}
}
}
Output:
B:\
C:\
E:\
J:\
P:\
S:\
U:\
V:\
X:\
Z:\