| 4260 | namespace { |
| 4261 | namespace fs = std::filesystem; |
| 4262 | int openFileForWrite(const fs::path &Filename) { |
| 4263 | int Fd = -1; |
| 4264 | const std::string PathStr = Filename.u8string(); |
| 4265 | #if WASMEDGE_OS_WINDOWS |
| 4266 | if (_sopen_s(&Fd, PathStr.c_str(), |
| 4267 | _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY, _SH_DENYNO, |
| 4268 | _S_IREAD | _S_IWRITE) != 0) { |
| 4269 | return -1; |
| 4270 | } |
| 4271 | #else |
| 4272 | Fd = open(PathStr.c_str(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
| 4273 | #endif |
| 4274 | return Fd; |
| 4275 | } |
| 4276 | |
| 4277 | int openFileForRead(const fs::path &Filename) { |
| 4278 | int Fd = -1; |