sdedic commented on a change in pull request #2969:
URL: https://github.com/apache/netbeans/pull/2969#discussion_r640692601



##########
File path: 
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
##########
@@ -2337,6 +2341,29 @@ private static boolean isArchiveFileImpl(final URL url, 
final boolean strict) {
         }
         return archiveRootProviderCache;
     }
+    
+    /**
+     * Hardcoded offending filename characters. Windows are more picky than 
Unixes; relying
+     * on just the current host OS will limit file portability when shared 
through VCS.
+     */
+    private static final Pattern ILLEGAL_FILENAME_CHARACTERS = 
Pattern.compile("[\\/:\"*?<>|]");
+    
+    /**
+     * Determines whether the string forms a valid filename (without a path 
component).
+     * @param fileName candidate string
+     * @return true, if the string can be used to name a file.
+     */

Review comment:
       Well. I was about task if, in your opinion, is this utility worth adding 
at all. But I've found ~9 occurrences of invalid filename characters (they 
differ, naturally ;)) 
   In addition, I have found this interesting post - 
https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
 ... really, you just can't make `PRN` folder under Windows :-D so I guess we 
could eventually fit more checks even in the `FileUtil.findFreeFileName` ...
   So I'll keep the utility + 
[NETBEANS-5720](https://issues.apache.org/jira/browse/NETBEANS-5720), 
[NETBEANS-5721](https://issues.apache.org/jira/browse/NETBEANS-5721) in 
addition.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to