diff options
author | Li Jin <dragon-fly@qq.com> | 2020-03-05 16:08:41 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-03-05 16:08:41 +0800 |
commit | 890fc913737c62c5d7e51636e0535b7b318a0d89 (patch) | |
tree | 8ca71fc3a2599ad1cbebcd3234dcb06292448037 /src/moonp.cpp | |
parent | 3b94999e55df35d19616e87d7f3b6fddf5b8a30b (diff) | |
download | yuescript-890fc913737c62c5d7e51636e0535b7b318a0d89.tar.gz yuescript-890fc913737c62c5d7e51636e0535b7b318a0d89.tar.bz2 yuescript-890fc913737c62c5d7e51636e0535b7b318a0d89.zip |
move functions of old export statement to global statement, make export statement work with Lua module system.
Diffstat (limited to 'src/moonp.cpp')
-rw-r--r-- | src/moonp.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/moonp.cpp b/src/moonp.cpp index ade1a1b..8026d50 100644 --- a/src/moonp.cpp +++ b/src/moonp.cpp | |||
@@ -81,10 +81,10 @@ int main(int narg, const char** args) { | |||
81 | if (!targetPath.empty() && targetPath.back() != '/' && targetPath.back() != '\\') { | 81 | if (!targetPath.empty() && targetPath.back() != '/' && targetPath.back() != '\\') { |
82 | targetPath.append("/"); | 82 | targetPath.append("/"); |
83 | } | 83 | } |
84 | std::list<std::future<std::result_of_t<std::decay_t<int()>()>>> results; | 84 | std::list<std::future<int>> results; |
85 | for (const auto& file : files) { | 85 | for (const auto& file : files) { |
86 | auto task = std::async(std::launch::async, [=]() { | 86 | auto task = std::async(std::launch::async, [=]() { |
87 | std::ifstream input(file, input.in); | 87 | std::ifstream input(file, std::ios::in); |
88 | if (input) { | 88 | if (input) { |
89 | std::string s( | 89 | std::string s( |
90 | (std::istreambuf_iterator<char>(input)), | 90 | (std::istreambuf_iterator<char>(input)), |
@@ -135,7 +135,7 @@ int main(int narg, const char** args) { | |||
135 | } else { | 135 | } else { |
136 | targetFile = resultFile; | 136 | targetFile = resultFile; |
137 | } | 137 | } |
138 | std::ofstream output(targetFile, output.trunc | output.out); | 138 | std::ofstream output(targetFile, std::ios::trunc | std::ios::out); |
139 | if (output) { | 139 | if (output) { |
140 | const auto& codes = std::get<0>(result); | 140 | const auto& codes = std::get<0>(result); |
141 | output.write(codes.c_str(), codes.size()); | 141 | output.write(codes.c_str(), codes.size()); |