public static boolean isValidFileName ( String name ) { try { if ( OsUtils . isWindows ( ) ) { if ( name . contains ( ">" ) || name . contains ( "<" ) ) return false ; name = name . toLowerCase ( ) ; //Windows is case insensitive } return new File ( name ) . getCanonicalFile ( ) . getName ( ) . equals ( name ) ; } catch ( Exception e ) { return false ; } }
Checks whether given name is valid for current user OS .