3348
3348
UTF8Filesystem = _UTF8Filesystem()
3351
class _CaseInsCasePresFilenameFeature(Feature):
3352
"""Is the file-system case insensitive, but case-preserving?"""
3355
fileno, name = tempfile.mkstemp(prefix='MixedCase')
3357
# first check truly case-preserving for created files, then check
3358
# case insensitive when opening existing files.
3359
name = osutils.normpath(name)
3360
base, rel = osutils.split(name)
3361
found_rel = osutils.canonical_relpath(base, name)
3362
return (found_rel == rel
3363
and os.path.isfile(name.upper())
3364
and os.path.isfile(name.lower()))
3369
def feature_name(self):
3370
return "case-insensitive case-preserving filesystem"
3372
CaseInsCasePresFilenameFeature = _CaseInsCasePresFilenameFeature()
3351
3375
class _CaseInsensitiveFilesystemFeature(Feature):
3352
"""Check if underlying filesystem is case-insensitive
3353
(e.g. on Windows, Cygwin, MacOS)
3376
"""Check if underlying filesystem is case-insensitive but *not* case
3379
# Note that on Windows, Cygwin, MacOS etc, the file-systems are far
3380
# more likely to be case preserving, so this case is rare.
3356
3382
def _probe(self):
3383
if CaseInsCasePresFilenameFeature.available():
3357
3386
if TestCaseWithMemoryTransport.TEST_ROOT is None:
3358
3387
root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
3359
3388
TestCaseWithMemoryTransport.TEST_ROOT = root