In order to construct file names that don't raise Errno::ENAMETOOLONG, I'd like to be able to access PC_NAME_MAX and PC_PATH_MAX from pathconf given a particular directory object.
I've attached a patch which exposes both of these values on a Dir object.
In order to construct file names that don't raise Errno::ENAMETOOLONG, I'd like to be able to access PC_NAME_MAX and PC_PATH_MAX from pathconf given a particular directory object.
I've attached a patch which exposes both of these values on a Dir object.
Hmm...
I don't think it's useful. why? fpatchconf() doesn't have an enough
portable and reliable meanings. example, fpathconf(PC_PATH_MAX) on
linux glibc always return PATH_MAX (=4096). but some linux filesystems
can only treat 256 bytes path length. Therefore, even if you properly
checked path length, you still might get
path length related error from syscalls.
I'm afraid this method bring rubyist a misunderstand.
The portable way to check the too long filename is just make a file and catch Errno::ENAMETOOLONG.
Unix has many related constants and functions but they are useless.