diff --git a/src/usages_clang.cpp b/src/usages_clang.cpp index 66bc258..1e2193f 100644 --- a/src/usages_clang.cpp +++ b/src/usages_clang.cpp @@ -737,7 +737,12 @@ void Usages::Clang::write_cache(const boost::filesystem::path &path, const Clang stream.close(); boost::filesystem::rename(tmp_file, full_cache_path, ec); if(ec) { - boost::filesystem::copy_file(tmp_file, full_cache_path, boost::filesystem::copy_options::overwrite_existing); + boost::filesystem::copy_file(tmp_file, full_cache_path, boost::filesystem::copy_options::overwrite_existing, ec); + if(ec) { // Workaround for Invalid cross-device link error + std::ifstream from(tmp_file.string(), std::ios::binary); + std::ofstream to(full_cache_path.string(), std::ios::binary); + to << from.rdbuf(); + } boost::filesystem::remove(tmp_file, ec); } }