]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
do not create invalid .lyx files when importing \i{}, \j{}, \l{} or \L{}.
[lyx.git] / src / lyxrc.C
index 03c9143eb07c401fbc083abb9517ecdbfe9c585a..00aeb0b56cd25758565120877b6633bb9085dd66 100644 (file)
@@ -48,6 +48,7 @@ namespace os = support::os;
 using support::ascii_lowercase;
 using support::bformat;
 using support::expandPath;
+using support::FileName;
 using support::getEnv;
 using support::libFileSearch;
 using support::token;
@@ -315,7 +316,7 @@ void oldFontFormat(string & family, string & foundry)
 } // namespace anon
 
 
-int LyXRC::read(string const & filename)
+int LyXRC::read(FileName const & filename)
 {
        LyXLex lexrc(lyxrcTags, lyxrcCount);
        if (lyxerr.debugging(Debug::PARSER))
@@ -369,12 +370,12 @@ int LyXRC::read(LyXLex & lexrc)
                switch (static_cast<LyXRCTags>(le)) {
                case RC_INPUT: // Include file
                        if (lexrc.next()) {
-                               string const tmp =
+                               FileName const tmp =
                                        libFileSearch(string(),
                                                      lexrc.getString());
                                if (read(tmp)) {
                                        lexrc.printError("Error reading "
-                                                        "included file: "+tmp);
+                                                        "included file: " + tmp.absFilename());
                                }
                        }
                        break;
@@ -1214,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);
 }
@@ -1488,7 +1489,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
        case RC_CONVERTER_CACHE_MAXAGE:
                if (ignore_system_lyxrc ||
                    converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
-                       os << "\\converter_cache_maxage"
+                       os << "\\converter_cache_maxage "
                           << converter_cache_maxage << '\n';
                }