Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/mbusb/multibootusb.git int…
Browse files Browse the repository at this point in the history
…o devel
  • Loading branch information
mbusb committed Apr 4, 2018
2 parents 0003e3c + 56b4290 commit 89bfaae
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/update_cfg_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,21 @@ def fix_desktop_image_in_thema_callback(install_dir_for_grub,
dir_, fname):
if not fname.lower().endswith('.txt'):
return
log("Probing '%s'!" % fname)
theme_file = os.path.join(dir_, fname)
updated = False
with open(theme_file, 'r', encoding='utf-8') as f:
lines = []
pattern = re.compile(r'^desktop-image\s*:\s*(.*)$')
for line in f.readlines():
try:
src_lines = f.readlines()
except UnicodeDecodeError:
log("Unexpected encoding in %s" % theme_file)
return
lines = []
for line in src_lines:
line = line.rstrip()
m = pattern.match(line)
if m and m.group(1).startswith(('/', '"/')):
log("Updating '%s'" % line)
log("Updating '%s' in %s" % (line,theme_file))
updated = True
partial_path = m.group(1).strip('"').lstrip('/')
line = 'desktop-image: "%s/%s"' % \
Expand Down

0 comments on commit 89bfaae

Please sign in to comment.