mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Read the search replace patterns file differently
Might fix patterns not being recognized on windows
This commit is contained in:
parent
495bece5e8
commit
1d945ced65
@ -331,14 +331,12 @@ def abspath(x):
|
|||||||
|
|
||||||
|
|
||||||
def read_sr_patterns(path, log=None):
|
def read_sr_patterns(path, log=None):
|
||||||
import json, re, codecs
|
import json, re
|
||||||
pats = []
|
pats = []
|
||||||
with codecs.open(path, 'r', 'utf-8') as f:
|
with open(path, 'rb') as f:
|
||||||
|
lines = f.read().decode('utf-8').splitlines()
|
||||||
pat = None
|
pat = None
|
||||||
for line in f.readlines():
|
for line in lines:
|
||||||
if line.endswith(u'\n'):
|
|
||||||
line = line[:-1]
|
|
||||||
|
|
||||||
if pat is None:
|
if pat is None:
|
||||||
if not line.strip():
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user