mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-18 19:45:49 +00:00
Prefer WriteToFile over manual std;:ofstream usage.
This commit is contained in:
parent
327958dbe0
commit
bbe11e32eb
@ -128,11 +128,7 @@ void WriteToCache(Config* config, IndexFile& file) {
|
||||
<< "file-copy for " << file.path;
|
||||
CopyFileTo(cache_basename, file.path);
|
||||
} else {
|
||||
std::ofstream cache_content;
|
||||
cache_content.open(cache_basename);
|
||||
assert(cache_content.good());
|
||||
cache_content << file.file_contents_;
|
||||
cache_content.close();
|
||||
WriteToFile(cache_basename, file.file_contents_);
|
||||
}
|
||||
|
||||
std::string indexed_content = Serialize(file);
|
||||
|
@ -450,10 +450,7 @@ void UpdateTestExpectation(const std::string& filename,
|
||||
str.replace(it, expectation.size(), actual);
|
||||
|
||||
// Write it back out.
|
||||
std::ofstream of(filename,
|
||||
std::ios::out | std::ios::trunc | std::ios::binary);
|
||||
of.write(str.c_str(), str.size());
|
||||
of.close();
|
||||
WriteToFile(filename, str);
|
||||
}
|
||||
|
||||
void WriteToFile(const std::string& filename, const std::string& content) {
|
||||
|
@ -71,6 +71,11 @@ void WorkingFile::OnBufferContentUpdated() {
|
||||
else
|
||||
it->second.push_back(i + 1);
|
||||
}
|
||||
|
||||
std::string path = filename;
|
||||
path = ReplaceAll(path, "/", "_");
|
||||
WriteToFile("/usr/local/google/home/jdufault/cquery/tmp/" + path,
|
||||
buffer_content);
|
||||
}
|
||||
|
||||
optional<int> WorkingFile::GetBufferLineFromIndexLine(int index_line) const {
|
||||
|
Loading…
Reference in New Issue
Block a user