##// END OF EJS Templates
util: rename _windows_reserved_filenames and _windows_reserved_chars
Adrian Buehlmann -
r14262:23cd7eef default
parent child Browse files
Show More
@@ -445,10 +445,10 b' def copyfiles(src, dst, hardlink=None):'
445
445
446 return hardlink, num
446 return hardlink, num
447
447
448 _windows_reserved_filenames = '''con prn aux nul
448 _winreservednames = '''con prn aux nul
449 com1 com2 com3 com4 com5 com6 com7 com8 com9
449 com1 com2 com3 com4 com5 com6 com7 com8 com9
450 lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split()
450 lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split()
451 _windows_reserved_chars = ':*?"<>|'
451 _winreservedchars = ':*?"<>|'
452 def checkwinfilename(path):
452 def checkwinfilename(path):
453 '''Check that the base-relative path is a valid filename on Windows.
453 '''Check that the base-relative path is a valid filename on Windows.
454 Returns None if the path is ok, or a UI string describing the problem.
454 Returns None if the path is ok, or a UI string describing the problem.
@@ -472,14 +472,14 b' def checkwinfilename(path):'
472 if not n:
472 if not n:
473 continue
473 continue
474 for c in n:
474 for c in n:
475 if c in _windows_reserved_chars:
475 if c in _winreservedchars:
476 return _("filename contains '%s', which is reserved "
476 return _("filename contains '%s', which is reserved "
477 "on Windows") % c
477 "on Windows") % c
478 if ord(c) <= 31:
478 if ord(c) <= 31:
479 return _("filename contains %r, which is invalid "
479 return _("filename contains %r, which is invalid "
480 "on Windows") % c
480 "on Windows") % c
481 base = n.split('.')[0]
481 base = n.split('.')[0]
482 if base and base.lower() in _windows_reserved_filenames:
482 if base and base.lower() in _winreservednames:
483 return _("filename contains '%s', which is reserved "
483 return _("filename contains '%s', which is reserved "
484 "on Windows") % base
484 "on Windows") % base
485 t = n[-1]
485 t = n[-1]
General Comments 0
You need to be logged in to leave comments. Login now