From 9e973fc73e9e564a0b6e0f09a3793521405cf980 Mon Sep 17 00:00:00 2001 From: Takayuki Matsuoka Date: Sun, 23 Apr 2023 19:27:33 +0900 Subject: [PATCH] Fix: improve compatibility with Windows' filesystem::path --- src/cpp/piper.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cpp/piper.hpp b/src/cpp/piper.hpp index 7f07afc..933d8cc 100644 --- a/src/cpp/piper.hpp +++ b/src/cpp/piper.hpp @@ -28,17 +28,19 @@ struct Voice { }; void initialize(std::filesystem::path cwd) { - const char *dataPath = NULL; + string dataPath; auto cwdDataPath = std::filesystem::absolute(cwd.append("espeak-ng-data")); if (std::filesystem::is_directory(cwdDataPath)) { - dataPath = cwdDataPath.c_str(); + dataPath = cwdDataPath.string(); } + cerr << "dataPath: " << dataPath << endl; + // Set up espeak-ng for calling espeak_TextToPhonemes int result = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, /*buflength*/ 0, - /*path*/ dataPath, + /*path*/ dataPath.c_str(), /*options*/ 0); if (result < 0) { throw runtime_error("Failed to initialize eSpeak-ng");