Oh definitely not OS-specific. Windows has FAT32, FATX/XFAT (forget the name; they use it on Xbox), NTFS, possibly more. macOS has HFS, HFS+, and APFS. Linux has at least a dozen or more. BSD has its own (possibly different between FreeBSD and OpenBSD), then Solaris, AIX, etc.
On 15 November 2017 at 14:11, Gary Gregory <garydgreg...@gmail.com> wrote: > On Wed, Nov 15, 2017 at 12:53 PM, Jan Matèrne (jhm) <apa...@materne.de> > wrote: > > > s/MAC_OSX_9/MAC_OS_9/ > > What about older versions of MacOS? > > UNKNOWN(31,1024) // smallest values for safety > > Are there differences between FAT,FAT32,NTFS,reiserfs,... ? > > > > Here you go: https://en.wikipedia.org/wiki/Comparison_of_file_systems > > This makes me wonder of the enum name should not be OS name but the FS name > like FAT32. > > Gary > > > > > > Jan > > > > > > > -----Ursprüngliche Nachricht----- > > > Von: Gary Gregory [mailto:garydgreg...@gmail.com] > > > Gesendet: Mittwoch, 15. November 2017 18:34 > > > An: Commons Developers List > > > Betreff: Re: [io] New enum for file system info? > > > > > > On Wed, Nov 15, 2017 at 10:30 AM, Gary Gregory <garydgreg...@gmail.com > > > > > wrote: > > > > > > > I find myself writing and using non-OO code around things like: > > > > > > > > private final int MAX_FILE_NAME_LENGTH_WINDOWS = 255; > > > > private final int MAX_FILE_NAME_LENGTH_LINUX = 255; > > > > private final int MAX_FILE_NAME_LENGTH_MAC = 255; > > > > private final int MAX_FILE_NAME_LENGTH_MAC_OS9 = 31; > > > > > > > > private final int MAX_FILE_PATH_LENGTH_WINDOWS = 32000; > > > > private final int MAX_FILE_PATH_LENGTH_LINUX = 4096; > > > > private final int MAX_FILE_PATH_LENGTH_MAC = 1024; > > > > > > > > But that is not even right for older Macs which limits file names to > > > > 31 chars. > > > > > > > > I was thinking of creating a new enum: > > > > > > > > package org.apache.commons.io; > > > > > > > > public enum FileSystem { > > > > > > > > LINUX(255, 4096), > > > > MAC_OSX(255, 1024), > > > > MAC_OSX_9(31, 1024), > > > > WINDOWS(255, 32000); > > > > > > > > private final long maxFileLength; > > > > private final long maxPathLength; > > > > > > > > private FileSystem(long maxFileLength, long maxPathLength) { > > > > this.maxFileLength = maxFileLength; > > > > this.maxPathLength = maxPathLength; > > > > } > > > > > > > > public long getMaxFileLength() { > > > > return maxFileLength; > > > > } > > > > > > > > public long getMaxPathLength() { > > > > return maxPathLength; > > > > } > > > > > > > > public boolean isIllegalFileName(char ch) { > > > > ... > > > > } > > > > > > > > public String toLegalFileName(String candidate, char replacement) > > > { > > > > ... > > > > } > > > > > > > > } > > > > > > > > I would also move the new method from https://issues.apache.org/ > > > > jira/browse/IO-555 there and rename it "isIllegalFileName(char)" > > > > > > > > Thoughts? > > > > > > > > > > The enum would obviously need a "public static FileSystem getCurrent()" > > > method. > > > > > > Gary > > > > > > > > > > > > > > Gary > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > > For additional commands, e-mail: dev-h...@commons.apache.org > > > > > -- Matt Sicker <boa...@gmail.com>