I'm writing a program for Mac OS X that allows the user to drag a row from a list in the application to Finder, where it automatically exports the data represented by the row to a file named after the row's display name (which must be able to contain almost any Unicode character). The user can edit this display name in the application, and it places no restrictions on this name for its internal use, but obviously I need to strip :
and /
from individual path components on OS X.
This program only runs on OS X, but in theory someone could write a similar program on another OS and want to import these files, or the user could be trying to export to a FAT32 or NTFS filesystem.
How far should I go?
- Strip / replace leading
.
characters to avoid a hidden file? - Strip characters like
\
or<
which may not be valid on the target filesystem? - Fix up names that might confuse OS X tools, like
-rf *
? - Fix up names that might confuse non-OS X tools, like
con
?
Is this worth a preemptive pop-up dialog full of text about filename compatibility? Or should I punt and show the user the error the OS gives me when I try to open the file?