Commit 327e7a3
authored
Native Windows support (#102)
This pull request introduces support for native Windows by adding Windows-specific implementations and conditional compilation to various parts of the codebase. The changes ensure compatibility with Windows systems while maintaining functionality on other platforms.
### Build System Updates:
* Added a Windows runner (`windows-latest`) to the GitHub Actions workflow in `.github/workflows/cmake.yml`. Updated CMake configuration, build, and test steps to handle Windows-specific paths and commands.
### Codebase Updates for Windows Compatibility:
* **CMake Adjustments**: Introduced conditional flags for MSVC in `cmake/CXXSniffer.cmake` to set appropriate compiler flags for Windows (`/W4`) versus other platforms (`-Wall -Wextra`).
* **Datetime Handling**: Updated `Datetime::timegm` in `src/Datetime.cpp` to use `_putenv_s` and `_tzset` for setting the time zone on Windows. [[1]](diffhunk://#diff-87bf33523de4b0db7b37702262674dbf849e9f79686761c334c1cd04412b295eR3127-R3136) [[2]](diffhunk://#diff-87bf33523de4b0db7b37702262674dbf849e9f79686761c334c1cd04412b295eR3145)
### Filesystem (`FS.cpp`) Enhancements:
* **Platform-Specific Includes and Macros**: Added Windows-specific headers and macros for filesystem operations, such as `_mkdir`, `_unlink`, and `FlushFileBuffers`. [[1]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR37-L45) [[2]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR74-R83)
* **Path Operations**: Implemented Windows-specific logic for `Path::realpath`, `Path::expand`, and `Path::glob` to handle Windows paths and environment variables like `USERPROFILE`. [[1]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR181-R211) [[2]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR358-R388) [[3]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR426) [[4]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR437-R441)
* **File and Directory Operations**: Added Windows-compatible implementations for file creation, removal, locking, unlocking, truncating, and directory operations like `create` and `remove_directory`. [[1]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR509-R511) [[2]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR522-R526) [[3]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR773-R779) [[4]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR1049-R1053) [[5]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR1065) [[6]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR1212) [[7]](diffhunk://#diff-46a62fa5a3343b36a9aae12dd7292196103643bcbee4e56901c9ed12ee8f87abR1251-R1275)
### Header File Updates:
* Updated `src/FS.h` to include Windows-specific headers and define `mode_t` for compatibility.
These changes collectively enable the codebase to function seamlessly on Windows platforms while preserving its behavior on Unix-like systems.1 parent 121f757 commit 327e7a3
File tree
9 files changed
+328
-21
lines changed- .github/workflows
- cmake
- src
9 files changed
+328
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | | - | |
35 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
36 | 50 | | |
37 | | - | |
38 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3124 | 3124 | | |
3125 | 3125 | | |
3126 | 3126 | | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
3127 | 3137 | | |
3128 | 3138 | | |
3129 | 3139 | | |
| |||
3132 | 3142 | | |
3133 | 3143 | | |
3134 | 3144 | | |
| 3145 | + | |
3135 | 3146 | | |
3136 | 3147 | | |
3137 | 3148 | | |
| |||
0 commit comments