X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=rescan_fs.py;h=346f92b28f387c3434731ec9d0e19e4949955aa2;hb=8d05302c387169fa41f23b293c404bd3cb6561d6;hp=0abed44c1b3feaec860317f64ee930138570ac05;hpb=577e6f1ca8e079172fcd42f373f5948e84d3d0b6;p=xsetbg.git diff --git a/rescan_fs.py b/rescan_fs.py index 0abed44..346f92b 100755 --- a/rescan_fs.py +++ b/rescan_fs.py @@ -9,8 +9,11 @@ This file is a part of XSetBg. import os import subprocess + from sqlobject import SQLObjectNotFound from sqlobject.sqlbuilder import Insert, Update, Delete +from m_lib.defenc import default_encoding + from xsetbg_conf import xsetbg_dir, xsetbg_conf from xsetbg_db import recreate_db, SQLiteMassInsert @@ -58,7 +61,9 @@ with SQLiteMassInsert() as txn: # List images in all subdirectories for dirpath, dirs, files in os.walk(image_dir): for file in files: - full_name = os.path.join(dirpath, file).decode(fs_encoding) + if default_encoding != fs_encoding: + file = file.encode().decode(fs_encoding) + full_name = os.path.join(dirpath, file) try: row = xsetbg_db.byFull_name(full_name) except SQLObjectNotFound: