diff --git a/src/calibre/ebooks/rtf2xml/tokenize.py b/src/calibre/ebooks/rtf2xml/tokenize.py index ad12daa211..45887f33e7 100755 --- a/src/calibre/ebooks/rtf2xml/tokenize.py +++ b/src/calibre/ebooks/rtf2xml/tokenize.py @@ -72,7 +72,7 @@ class Tokenize: return line def __compile_expressions(self): self.__ms_hex_exp = re.compile(r"\\\'(..)") - self.__utf_exp = re.compile(r"\\u(-?\d{3,6})") + self.__utf_exp = re.compile(r"\\u(-?\d{3,6}) {0,1}") self.__splitexp = re.compile(r"(\\[\\{}]|{|}|\\[^\s\\{}&]+(?:\s)?)") self.__par_exp = re.compile(r'\\$') self.__mixed_exp = re.compile(r"(\\[a-zA-Z]+\d+)(\D+)") diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 1e06f2eb0c..26bd764ad4 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -1621,12 +1621,13 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): try: os.makedirs(self.library_path) except: - self.library_path = os.path.expanduser('~/Library') + self.library_path = os.path.expanduser('~/CalibreLibrary') error_dialog(self, _('Invalid library location'), _('Could not access %s. Using %s as the library.')% (repr(self.library_path), repr(self.library_path)) ).exec_() - os.makedirs(self.library_path) + if not os.path.exists(self.library_path): + os.makedirs(self.library_path) def read_settings(self):