Group source files outside of the project by a cache sub-directory

This commit is contained in:
Fangrui Song 2018-01-29 23:53:32 -08:00
parent fe3b9c4a8a
commit c8605dc4a9
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -572,8 +572,11 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
// 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;