mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-14 03:11:03 +00:00
added path encoding
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3145 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
c33e6d5907
commit
d05c68ef74
1 changed files with 17 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ File and path utilities.
|
|||
"""
|
||||
|
||||
import os
|
||||
import locale
|
||||
import stat
|
||||
import fnmatch
|
||||
|
||||
|
|
@ -157,6 +158,22 @@ def get_mtime (filename):
|
|||
return 0
|
||||
|
||||
|
||||
# http://developer.gnome.org/doc/API/2.0/glib/glib-running.html
|
||||
if "G_FILENAME_ENCODING" in os.environ:
|
||||
FSCODING = os.environ["G_FILENAME_ENCODING"].split(",")[0]
|
||||
if FSCODING == "@locale":
|
||||
FSCODING = locale.getpreferredencoding()
|
||||
elif "G_BROKEN_FILENAMES" in os.environ:
|
||||
FSCODING = locale.getpreferredencoding()
|
||||
else:
|
||||
FSCODING = "utf-8"
|
||||
|
||||
def pathencode (path):
|
||||
if isinstance(path, unicode) and not os.path.supports_unicode_filenames:
|
||||
path = path.encode(FSCODING, "replace")
|
||||
return path
|
||||
|
||||
|
||||
# cache for modified check {absolute filename -> mtime}
|
||||
_mtime_cache = {}
|
||||
def has_changed (filename):
|
||||
|
|
|
|||
Loading…
Reference in a new issue