Skip to content
Permalink
Browse files

change case insensitivity test

  • Loading branch information
willmcgugan committed May 5, 2019
1 parent 2735215 commit c29d3cb69b0e2a7ab37ebd3b28cfa81dbbb10036
Showing with 10 additions and 6 deletions.
  1. +1 −1 CHANGELOG.md
  2. +9 −5 fs/osfs.py
@@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Removed case_insensitive meta value from OSFS meta on OSX. normcase check doesn't work on OSX (https://stackoverflow.com/questions/7870041/check-if-file-system-is-case-insensitive-in-python)
- Detect case insensitivity using by writing temp file

## [2.4.4] - 2019-02-23

@@ -17,6 +17,7 @@
import shutil
import stat
import sys
import tempfile
import typing

import six
@@ -134,7 +135,6 @@ def __init__(
raise errors.CreateFailed("root path does not exist")

_meta = self._meta = {
"case_insensitive": os.path.normcase("Aa") == "aa",
"network": False,
"read_only": False,
"supports_rename": True,
@@ -143,10 +143,14 @@ def __init__(
"virtual": False,
}

if platform.system() == "Darwin":
# Standard test doesn't work on OSX.
# Best we can say is we don't know.
del _meta["case_insensitive"]
try:
# https://stackoverflow.com/questions/7870041/check-if-file-system-is-case-insensitive-in-python
# I don't know of a better way of detecting case insensitivity of a filesystem
with tempfile.NamedTemporaryFile(prefix="TmP") as _tmp_file:
_meta["case_insensitive"] = os.path.exists(_tmp_file.name.lower())
except Exception:
if platform.system() != "Darwin":
_meta["case_insensitive"] = os.path.normcase("Aa") == "aa"

if _WINDOWS_PLATFORM: # pragma: no cover
_meta["invalid_path_chars"] = (

0 comments on commit c29d3cb

Please sign in to comment.
You can’t perform that action at this time.