mirror of
https://github.com/DanielSWolf/rhubarb-lip-sync.git
synced 2026-11-21 12:25:08 +00:00
Replace boost::filesystem with std::filesystem
This allows us to use a header-only copy of Boost
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include "tools/platformTools.h"
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <fstream>
|
||||
#include "core/appInfo.h"
|
||||
#include <cmath>
|
||||
#include <gsl_util.h>
|
||||
@@ -17,7 +17,7 @@ using std::map;
|
||||
using std::tuple;
|
||||
using std::get;
|
||||
using std::endl;
|
||||
using boost::filesystem::path;
|
||||
using std::filesystem::path;
|
||||
|
||||
using Unigram = string;
|
||||
using Bigram = tuple<string, string>;
|
||||
@@ -151,7 +151,7 @@ void createLanguageModelFile(const vector<string>& words, const path& filePath)
|
||||
map<Bigram, double> bigramBackoffWeights =
|
||||
getBigramBackoffWeights(bigramCounts, bigramProbabilities, trigramCounts, discountMass);
|
||||
|
||||
boost::filesystem::ofstream file(filePath);
|
||||
std::ofstream file(filePath);
|
||||
file << "Generated by " << appName << " " << appVersion << endl << endl;
|
||||
|
||||
file << "\\data\\" << endl;
|
||||
@@ -193,9 +193,9 @@ lambda_unique_ptr<ngram_model_t> createLanguageModel(
|
||||
) {
|
||||
path tempFilePath = getTempFilePath();
|
||||
createLanguageModelFile(words, tempFilePath);
|
||||
auto deleteTempFile = gsl::finally([&]() { boost::filesystem::remove(tempFilePath); });
|
||||
auto deleteTempFile = gsl::finally([&]() { std::filesystem::remove(tempFilePath); });
|
||||
|
||||
return lambda_unique_ptr<ngram_model_t>(
|
||||
ngram_model_read(decoder.config, tempFilePath.string().c_str(), NGRAM_ARPA, decoder.lmath),
|
||||
ngram_model_read(decoder.config, tempFilePath.u8string().c_str(), NGRAM_ARPA, decoder.lmath),
|
||||
[](ngram_model_t* lm) { ngram_model_free(lm); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user