X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fcontrollers%2Ftex_helpers.C;h=fbc78c2d78b1e023b9e8e120072aa9084662b282;hb=534095ce9e82d0b0f875540f7306ff218df3b5aa;hp=2441403e73729fcdcd1aec4727f4550be2089b37;hpb=af5a86798293fb79b99c053c7eb060c738d32cf6;p=lyx.git diff --git a/src/frontends/controllers/tex_helpers.C b/src/frontends/controllers/tex_helpers.C index 2441403e73..fbc78c2d78 100644 --- a/src/frontends/controllers/tex_helpers.C +++ b/src/frontends/controllers/tex_helpers.C @@ -35,6 +35,7 @@ namespace lyx { using support::bformat; using support::contains; +using support::FileName; using support::getExtension; using support::getFileContents; using support::getVectorFromString; @@ -53,15 +54,16 @@ void rescanTexStyles() { // Run rescan in user lyx directory Path p(package().user_support()); - string const command = libFileSearch("scripts", "TeXFiles.py"); + FileName const command = libFileSearch("scripts", "TeXFiles.py"); Systemcall one; int const status = one.startscript(Systemcall::Wait, lyx::support::os::python() + ' ' + - quoteName(command)); + quoteName(command.toFilesystemEncoding())); if (status == 0) return; + // FIXME UNICODE Alert::error(_("Could not update TeX information"), - bformat(_("The script `%s' failed."), command)); + bformat(_("The script `%s' failed."), lyx::from_utf8(command.absFilename()))); } @@ -79,7 +81,7 @@ void texhash() void getTexFileList(string const & filename, std::vector & list) { list.clear(); - string const file = libFileSearch("", filename); + FileName const file = libFileSearch("", filename); if (file.empty()) return; @@ -101,9 +103,11 @@ void getTexFileList(string const & filename, std::vector & list) string const getListOfOptions(string const & classname, string const & type) { - string const filename = getTexFileFromList(classname,type); + FileName const filename(getTexFileFromList(classname, type)); + if (filename.empty()) + return string(); string optionList = string(); - std::ifstream is(filename.c_str()); + std::ifstream is(filename.toFilesystemEncoding().c_str()); while (is) { string s; is >> s; @@ -137,8 +141,12 @@ string const getTexFileFromList(string const & file, lstfile = "bstFiles.lst"; else if (type == "bib") lstfile = "bibFiles.lst"; - string const allClasses = getFileContents(libFileSearch(string(), - lstfile)); + FileName const abslstfile = libFileSearch(string(), lstfile); + if (abslstfile.empty()) { + lyxerr << "File `'" << lstfile << "' not found." << endl; + return string(); + } + string const allClasses = getFileContents(abslstfile); int entries = 0; string classfile = token(allClasses, '\n', entries); int count = 0;