]> git.lyx.org Git - lyx.git/blobdiff - src/ConverterCache.C
Scons: update_po target, part one: language_l10n.pot
[lyx.git] / src / ConverterCache.C
index 9fca48e21dfaab311a8f6146ffab3bd07e548fbf..9a0ca686f4a482794ca8208dbf89efadeb1e14fd 100644 (file)
@@ -115,7 +115,7 @@ void ConverterCache::Impl::readIndex()
                CacheItem item(orig_from_name, to_format, timestamp, checksum);
 
                // Don't cache files that do not exist anymore
-               if (!fs::exists(orig_from)) {
+               if (!fs::exists(orig_from_name.toFilesystemEncoding())) {
                        lyxerr[Debug::FILES] << "Not caching file `"
                                << orig_from << "' (does not exist anymore)."
                                << std::endl;
@@ -216,7 +216,8 @@ ConverterCache::~ConverterCache()
 void ConverterCache::add(FileName const & orig_from, string const & to_format,
                FileName const & converted_file) const
 {
-       if (!lyxrc.use_converter_cache)
+       if (!lyxrc.use_converter_cache || orig_from.empty() ||
+           converted_file.empty())
                return;
        lyxerr[Debug::FILES] << BOOST_CURRENT_FUNCTION << ' ' << orig_from
                             << ' ' << to_format << ' ' << converted_file
@@ -226,7 +227,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
        CacheItem * item = pimpl_->find(orig_from, to_format);
 
        time_t const timestamp = fs::last_write_time(orig_from.toFilesystemEncoding());
-       Mover const & mover = movers(to_format);
+       Mover const & mover = getMover(to_format);
        if (item) {
                lyxerr[Debug::FILES] << "ConverterCache::add(" << orig_from << "):\n"
                                        "The file is already in the cache."
@@ -269,7 +270,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
 void ConverterCache::remove(FileName const & orig_from,
                string const & to_format) const
 {
-       if (!lyxrc.use_converter_cache)
+       if (!lyxrc.use_converter_cache || orig_from.empty())
                return;
        lyxerr[Debug::FILES] << BOOST_CURRENT_FUNCTION << ' ' << orig_from
                             << ' ' << to_format << std::endl;
@@ -290,7 +291,7 @@ void ConverterCache::remove(FileName const & orig_from,
 bool ConverterCache::inCache(FileName const & orig_from,
                string const & to_format) const
 {
-       if (!lyxrc.use_converter_cache)
+       if (!lyxrc.use_converter_cache || orig_from.empty())
                return false;
        lyxerr[Debug::FILES] << BOOST_CURRENT_FUNCTION << ' ' << orig_from
                             << ' ' << to_format << std::endl;
@@ -330,14 +331,14 @@ FileName const & ConverterCache::cacheName(FileName const & orig_from,
 bool ConverterCache::copy(FileName const & orig_from, string const & to_format,
                FileName const & dest) const
 {
-       if (!lyxrc.use_converter_cache)
+       if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty())
                return false;
        lyxerr[Debug::FILES] << BOOST_CURRENT_FUNCTION << ' ' << orig_from
                             << ' ' << to_format << ' ' << dest << std::endl;
 
        CacheItem * const item = pimpl_->find(orig_from, to_format);
        BOOST_ASSERT(item);
-       Mover const & mover = movers(to_format);
+       Mover const & mover = getMover(to_format);
        return mover.copy(item->cache_name, dest);
 }