Skip to content

Instantly share code, notes, and snippets.

@k-takata
Created May 30, 2014 10:22
Show Gist options
  • Save k-takata/846bad3960daefc4847b to your computer and use it in GitHub Desktop.
Save k-takata/846bad3960daefc4847b to your computer and use it in GitHub Desktop.
--- a/plugin/editorconfig-core-py/editorconfig/ini.py
+++ b/plugin/editorconfig-core-py/editorconfig/ini.py
@@ -17,10 +17,10 @@ import re
from codecs import open
import posixpath
from os import sep
-from os.path import normcase, dirname
+from os.path import dirname
from editorconfig.exceptions import ParsingError
-from editorconfig.fnmatch import fnmatch
+from editorconfig.fnmatch import fnmatchcase
from editorconfig.odict import OrderedDict
from editorconfig.compat import u
@@ -59,7 +59,7 @@ class EditorConfigParser(object):
def matches_filename(self, config_filename, glob):
"""Return True if section glob matches filename"""
- config_dirname = normcase(dirname(config_filename)).replace(sep, '/')
+ config_dirname = dirname(config_filename).replace(sep, '/')
glob = glob.replace("\\#", "#")
glob = glob.replace("\\;", ";")
if '/' in glob:
@@ -68,7 +68,7 @@ class EditorConfigParser(object):
glob = posixpath.join(config_dirname, glob)
else:
glob = posixpath.join('**/', glob)
- return fnmatch(self.filename, glob)
+ return fnmatchcase(self.filename.replace(sep, '/'), glob)
def read(self, filename):
"""Read and parse single EditorConfig file"""
@xuhdev
Copy link

xuhdev commented Oct 1, 2014

The removal of normcase makes path shortening not available: X:\a\b\..\c would not be shortened. Anyway, see my new comment in editorconfig/editorconfig#144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment