Glob syntax / Javadoc

Alan Bateman Alan.Bateman at Sun.COM
Tue Apr 7 08:29:02 PDT 2009


Salter, Thomas A wrote:
> In the Javadoc for FileSystem.getPathMatcher, the explanations for the /home/* syntaxes explicitly state "on UNIX platforms".  Shouldn't these forms match on Windows platforms as well?  How else do you write a platform-independent pattern?  I'd think the best definition would be to match the name separator character returned by FileSystem.getSeparator().
>   
The examples you refer are just examples to demonstrate the syntax but 
yes,  the intention in that the separator matches itself. That works 
well for patterns that are input by the user (say in a command-line tool 
or file dialog). If code is creating patterns programmatically then it 
will need to use the separator, eg:
  String glob = dir.toString() + sep + "*.java";

-Alan.




More information about the nio-discuss mailing list