Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6975/src/util
Modified Files:
fileops.py vfs.py
Log Message:
Handle filenames internally as unicode objects.
This does *NOT* affect filenames that have only ASCII chars, since the translation
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é
(e acute, \xe9) and others.
I tested with Video, Images and Music modules, but *NOT* with Games, so if you have
the games modules, give it a try.
It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL, which
may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
Index: fileops.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/fileops.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** fileops.py 16 Jan 2004 16:23:29 -0000 1.13
--- fileops.py 5 Feb 2004 02:52:26 -0000 1.14
***************
*** 11,14 ****
--- 11,23 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.14 2004/02/05 02:52:26 gsbarbieri
+ # Handle filenames internally as unicode objects.
+ #
+ # This does *NOT* affect filenames that have only ASCII chars, since the translation
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é
(e acute, \xe9) and others.
+ #
+ # I tested with Video, Images and Music modules, but *NOT* with Games, so if you
have the games modules, give it a try.
+ #
+ # It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL,
which may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
+ #
# Revision 1.13 2004/01/16 16:23:29 dischi
# add softlink checking
***************
*** 152,155 ****
--- 161,173 ----
pointed to by path.
"""
+ encoding = config.encoding
+ try:
+ if type( path ) == unicode:
+ path = path.encode( encoding )
+ except Exception, e:
+ print "ERROR:" + \
+ "Could not encode %s to \"%s\" encoding: %s" % \
+ ( repr( path ), encoding, e )
+
s = os.statvfs(path)
return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
***************
*** 162,165 ****
--- 180,193 ----
pointed to by path.
"""
+
+ encoding = config.encoding
+ try:
+ if type( path ) == unicode:
+ path = path.encode( encoding )
+ except Exception, e:
+ print "ERROR:" + \
+ "Could not encode %s to \"%s\" encoding: %s" % \
+ ( repr( path ), encoding, e )
+
s = os.statvfs(path)
return s[statvfs.F_BLOCKS] * long(s[statvfs.F_BSIZE])
Index: vfs.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/vfs.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** vfs.py 4 Feb 2004 11:54:27 -0000 1.13
--- vfs.py 5 Feb 2004 02:52:26 -0000 1.14
***************
*** 17,20 ****
--- 17,29 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.14 2004/02/05 02:52:26 gsbarbieri
+ # Handle filenames internally as unicode objects.
+ #
+ # This does *NOT* affect filenames that have only ASCII chars, since the translation
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é
(e acute, \xe9) and others.
+ #
+ # I tested with Video, Images and Music modules, but *NOT* with Games, so if you
have the games modules, give it a try.
+ #
+ # It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL,
which may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
+ #
# Revision 1.13 2004/02/04 11:54:27 dischi
# check if directory is not overlay_dir
***************
*** 208,211 ****
--- 217,229 ----
files = []
+
+ encoding=config.encoding
+ try:
+ if type( directory ) == str:
+ directory = unicode( directory, encoding )
+ except Exception, e:
+ print "ERROR:" + \
+ "Could not convert %s to unicode using \"%s\" encoding: %s" % (
repr( directory ), encoding, e )
+
if include_dot_files:
for f in os.listdir(directory):
***************
*** 222,226 ****
overlay = getoverlay(directory)
if overlay and overlay != directory and os.path.isdir(overlay):
! for f in ([ overlay + fname for fname in os.listdir(overlay) ]):
if not os.path.isdir(f) and not f.endswith('.raw'):
files.append(f)
--- 240,254 ----
overlay = getoverlay(directory)
if overlay and overlay != directory and os.path.isdir(overlay):
! for fname in os.listdir( overlay ):
!
! if type( fname ) == str:
! try:
! fname = unicode( fname, encoding )
! except Exception, e:
! print "ERROR:" + \
! "Could not convert %s to unicode using \"%s\"
encoding: %s" % ( repr( fname ), encoding, e )
!
! f = overlay + fname
!
if not os.path.isdir(f) and not f.endswith('.raw'):
files.append(f)
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog