diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 2e6109c9..d63cc101 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -50,7 +50,8 @@ struct RealCacheManager : ICacheManager { cache_file = EscapeFileName(config_->projectRoot) + '/' + EscapeFileName(source_file.substr(len)); } else { - cache_file = EscapeFileName(source_file); + cache_file = '@' + EscapeFileName(config_->projectRoot) + '/' + + EscapeFileName(source_file); } return config_->cacheDirectory + cache_file; diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 9b6aac7d..adedd608 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -572,8 +572,11 @@ struct InitializeHandler : BaseMessageHandler { // Set project root. config->projectRoot = NormalizePath(request->params.rootUri->GetPath()); EnsureEndsInSlash(config->projectRoot); + // Create two cache directories for files inside and outside of the project. MakeDirectoryRecursive(config->cacheDirectory + EscapeFileName(config->projectRoot)); + MakeDirectoryRecursive(config->cacheDirectory + + '@' + EscapeFileName(config->projectRoot)); Timer time;