convert some more filenames for unicode

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-11-29 21:47:37 +00:00
parent 1116115055
commit bb2dc9c83f
7 changed files with 21 additions and 19 deletions

View File

@ -27,6 +27,8 @@
namespace lyx {
using support::changeExtension;
using support::FileName;
using support::makeAbsPath;
using support::onlyFilename;
using support::split;
using support::Systemcall;
@ -62,7 +64,9 @@ int Chktex::scanLogFile(TeXErrors & terr)
{
int retval = 0;
string const tmp = onlyFilename(changeExtension(file, ".log"));
// FIXME: Find out whether we can onlyFilename() is really needed,
// or whether makeAbsPath(onlyFilename()) is a noop here
FileName const tmp(makeAbsPath(onlyFilename(changeExtension(file, ".log"))));
#if USE_BOOST_FORMAT
boost::basic_format<char_type> msg(_("ChkTeX warning id # %1$d"));
@ -72,7 +76,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
docstring token;
// FIXME UNICODE
// We have no idea what the encoding of the error file is
idocfstream ifs(tmp.c_str());
idocfstream ifs(tmp.toFilesystemEncoding().c_str());
while (getline(ifs, token)) {
docstring srcfile;
docstring line;

View File

@ -454,16 +454,16 @@ Aux_Info const LaTeX::scanAuxFile(string const & file)
{
Aux_Info result;
result.aux_file = file;
scanAuxFile(file, result);
scanAuxFile(FileName(makeAbsPath(file)), result);
return result;
}
void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
void LaTeX::scanAuxFile(FileName const & file, Aux_Info & aux_info)
{
lyxerr[Debug::LATEX] << "Scanning aux file: " << file << endl;
ifstream ifs(file.c_str());
ifstream ifs(file.toFilesystemEncoding().c_str());
string token;
static regex const reg1("\\\\citation\\{([^}]+)\\}");
static regex const reg2("\\\\bibdata\\{([^}]+)\\}");
@ -504,7 +504,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
aux_info.styles.insert(style);
} else if (regex_match(token, sub, reg4)) {
string const file2 = sub.str(1);
scanAuxFile(file2, aux_info);
scanAuxFile(FileName(makeAbsPath(file2)), aux_info);
}
}
}

View File

@ -172,7 +172,7 @@ private:
Aux_Info const scanAuxFile(std::string const &);
///
void scanAuxFile(std::string const &, Aux_Info &);
void scanAuxFile(support::FileName const &, Aux_Info &);
///
void updateBibtexDependencies(DepTable &,

View File

@ -1419,8 +1419,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
}
case LFUN_PREFERENCES_SAVE: {
support::Path p(package().user_support());
lyxrc.write("preferences", false);
lyxrc.write(FileName(makeAbsPath("preferences",
package().user_support())),
false);
break;
}

View File

@ -1215,9 +1215,9 @@ int LyXRC::read(LyXLex & lexrc)
}
void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
{
ofstream ofs(filename.c_str());
ofstream ofs(filename.toFilesystemEncoding().c_str());
if (ofs)
write(ofs, ignore_system_lyxrc);
}

View File

@ -162,7 +162,7 @@ private:
int read(LyXLex &);
public:
///
void write(std::string const & filename,
void write(support::FileName const & filename,
bool ignore_system_lyxrc) const;
///
void write(std::ostream & os,

View File

@ -27,6 +27,7 @@
namespace lyx {
namespace fs = boost::filesystem;
using support::FileName;
using support::libFileSearch;
using support::makeDisplayPath;
@ -34,10 +35,6 @@ using boost::bind;
using boost::regex;
using boost::smatch;
#ifndef CXX_GLOBAL_CSTD
using std::exit;
#endif
using std::endl;
using std::equal_to;
using std::find_if;
@ -182,15 +179,15 @@ LyXTextClassList::addTextClass(std::string const & textclass, std::string const
{
// only check for textclass.layout file, .cls can be anywhere in $TEXINPUTS
// NOTE: latex class name is defined in textclass.layout, which can be different from textclass
string layout_file = path + "/" + textclass + ".layout";
if (fs::exists(layout_file)) {
FileName const layout_file(path + '/' + textclass + ".layout");
if (fs::exists(layout_file.toFilesystemEncoding())) {
lyxerr[Debug::TCLASS] << "Adding class " << textclass << " from directory " << path << endl;
// Read .layout file and get description, real latex classname etc
//
// This is a C++ version of function processLayoutFile in configure.py,
// which uses the following regex
// \Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}
ifstream ifs(layout_file.c_str());
ifstream ifs(layout_file.toFilesystemEncoding().c_str());
static regex const reg("^#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*"
"(?:\\[([^,]*)(?:,.*)*\\])*\\s*\\{(.*)\\}\\s*");
string line;