Using Java 1.6 Filepath can be entered by user and then I apply various regular expressions to remove characters that are invalid for the platform (such as '?' is invalid on Windows), and check path length to ensure we end up with a valid filepath for the OS before trying to create the filepath.
But there are two problems:
- Its a pain working out what is valid or not for each platform.
- I'm making assumptions based on default filesystem for the platform, but of course an OSX system could be writing to a non-mac filesystem such a FAT32, in which case these checks will not be valid.
So I was hoping there would be a better way to do it with NIO2 in Java 7, but haven't found a solution yet, is there one ?
test
, rather than calling the static method. – Maladapted