Skip to content

Commit cdec915

Browse files
committed
Fix broken build for Windows
Windows does not provide a mkdir function with two parameters. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 8e55e52 commit cdec915

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

training/lang_model_helpers.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
// limitations under the License.
1515
#include "lang_model_helpers.h"
1616

17+
#if defined(_WIN32)
18+
#include <direct.h>
19+
#endif
1720
#include <sys/stat.h>
1821
#include <sys/types.h>
1922
#include <cstdlib>
@@ -37,7 +40,11 @@ bool WriteFile(const string& output_dir, const string& lang,
3740
string dirname = output_dir + "/" + lang;
3841
// Attempt to make the directory, but ignore errors, as it may not be a
3942
// standard filesystem, and the writer will complain if not successful.
43+
#if defined(_WIN32)
44+
_mkdir(dirname.c_str());
45+
#else
4046
mkdir(dirname.c_str(), S_IRWXU | S_IRWXG);
47+
#endif
4148
string filename = dirname + "/" + lang + suffix;
4249
if (writer == nullptr)
4350
return SaveDataToFile(data, filename.c_str());

0 commit comments

Comments
 (0)