Reputation: 2549
In Java, is there a way to check if a given File
object is a protected system file?
Some examples of File
objects which I'd expect to be classified as protected:
Windows
C:\WINDOWS\
C:\WINDOWS\explorer.exe
Others
~/Library/
/Library/
/var/
/sys/
/bin/
etc...
Upvotes: 3
Views: 373
Reputation: 533790
What is a system file is highly system dependant. Windows Explorer has a notion of system directories which it tries to hide from users. On Linux/Unix you could look at who owns the directories.
Generally speaking, you don't need to know this as the file permissions controls whether you can read/write/execute a file.
How will you use this information, in a way that permissions won't do for you?
Upvotes: 1