提交 08ec5775 编写于 作者: Z zdenop 提交者: GitHub

Merge pull request #1064 from stweil/win32

Fix broken build for Windows
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
#include "lang_model_helpers.h" #include "lang_model_helpers.h"
#if defined(_WIN32)
#include <direct.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <cstdlib> #include <cstdlib>
...@@ -37,7 +40,11 @@ bool WriteFile(const string& output_dir, const string& lang, ...@@ -37,7 +40,11 @@ bool WriteFile(const string& output_dir, const string& lang,
string dirname = output_dir + "/" + lang; string dirname = output_dir + "/" + lang;
// Attempt to make the directory, but ignore errors, as it may not be a // Attempt to make the directory, but ignore errors, as it may not be a
// standard filesystem, and the writer will complain if not successful. // standard filesystem, and the writer will complain if not successful.
#if defined(_WIN32)
_mkdir(dirname.c_str());
#else
mkdir(dirname.c_str(), S_IRWXU | S_IRWXG); mkdir(dirname.c_str(), S_IRWXU | S_IRWXG);
#endif
string filename = dirname + "/" + lang + suffix; string filename = dirname + "/" + lang + suffix;
if (writer == nullptr) if (writer == nullptr)
return SaveDataToFile(data, filename.c_str()); return SaveDataToFile(data, filename.c_str());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册