| 4275 | } |
| 4276 | |
| 4277 | int openFileForRead(const fs::path &Filename) { |
| 4278 | int Fd = -1; |
| 4279 | const std::string PathStr = Filename.u8string(); |
| 4280 | #if WASMEDGE_OS_WINDOWS |
| 4281 | if (_sopen_s(&Fd, PathStr.c_str(), _O_RDONLY | _O_BINARY, _SH_DENYNO, 0) != |
| 4282 | 0) { |
| 4283 | return -1; |
| 4284 | } |
| 4285 | #else |
| 4286 | Fd = open(PathStr.c_str(), O_RDONLY); |
| 4287 | #endif |
| 4288 | return Fd; |
| 4289 | } |
| 4290 | |
| 4291 | void closeFd(int Fd) { |
| 4292 | if (Fd == -1) |