forked from extern/httpie-cli
Handle that os.pathconf is posix-only
This commit is contained in:
parent
5300b0b490
commit
557911b606
@ -148,13 +148,17 @@ def trim_filename(filename, max_len):
|
|||||||
|
|
||||||
|
|
||||||
def get_filename_max_length(directory):
|
def get_filename_max_length(directory):
|
||||||
|
max_len = 255
|
||||||
try:
|
try:
|
||||||
max_len = os.pathconf(directory, 'PC_NAME_MAX')
|
pathconf = os.pathconf
|
||||||
except OSError as e:
|
except AttributeError:
|
||||||
if e.errno == errno.EINVAL:
|
pass # non-posix
|
||||||
max_len = 255
|
else:
|
||||||
else:
|
try:
|
||||||
raise
|
max_len = pathconf(directory, 'PC_NAME_MAX')
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.EINVAL:
|
||||||
|
raise
|
||||||
return max_len
|
return max_len
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user