fixes bug #1012110 by encoding the file name with the filesystemencoding

This commit is contained in:
Philip Ridout 2013-10-04 19:50:54 +01:00
parent c17826937c
commit 1cf4b8f4ce

View File

@ -29,6 +29,7 @@
import os import os
import logging import logging
import sys
if os.name == u'nt': if os.name == u'nt':
from ctypes import cdll from ctypes import cdll
@ -125,11 +126,13 @@ class PptviewDocument(PresentationDocument):
renderer = self.controller.plugin.renderer renderer = self.controller.plugin.renderer
rect = renderer.screens.current[u'size'] rect = renderer.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom()) rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\')) filepath = self.filepath.replace(u'/', u'\\')
if not os.path.isdir(self.get_temp_folder()): if not os.path.isdir(self.get_temp_folder()):
os.makedirs(self.get_temp_folder()) os.makedirs(self.get_temp_folder())
self.pptid = self.controller.process.OpenPPT(filepath, None, rect, preview_path = self.get_temp_folder() + u'\\slide'
str(self.get_temp_folder()) + '\\slide') file_system_encoding = sys.getfilesystemencoding()
self.pptid = self.controller.process.OpenPPT(filepath.encode(file_system_encoding), None, rect,
preview_path.encode(file_system_encoding))
if self.pptid >= 0: if self.pptid >= 0:
self.create_thumbnails() self.create_thumbnails()
self.stop_presentation() self.stop_presentation()