aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmir <60936780+elvodqa@users.noreply.github.com>2024-07-23 20:38:04 +0300
committerGitHub <noreply@github.com>2024-07-23 20:38:04 +0300
commit42833d04712fb31a2c1eeb1a6e9fc51628b652fa (patch)
tree7fc6c89051acdd04eceec106661bed72af0db98f
parentf3f08a4b47ecc2089be616eb9774ac3dd32e8a8d (diff)
parentefa8c92baba4c33d5d5bd21938c3127eadf3fd9e (diff)
Merge branch 'odin-lang:master' into master
-rw-r--r--core/os/os2/errors_windows.odin5
-rw-r--r--core/os/os2/file_windows.odin2
-rw-r--r--core/os/os2/path_windows.odin29
3 files changed, 28 insertions, 8 deletions
diff --git a/core/os/os2/errors_windows.odin b/core/os/os2/errors_windows.odin
index 3572afb14..6421d26ee 100644
--- a/core/os/os2/errors_windows.odin
+++ b/core/os/os2/errors_windows.odin
@@ -17,10 +17,7 @@ _error_string :: proc(errno: i32) -> string {
if idx, ok := slice.binary_search(ti.values, err); ok {
return ti.names[idx]
}
-
- // TODO(bill): _error_string for windows
- // FormatMessageW
- return ""
+ return "<unknown platform error>"
}
_get_platform_error :: proc() -> Error {
diff --git a/core/os/os2/file_windows.odin b/core/os/os2/file_windows.odin
index 9367e43d8..3c18d0546 100644
--- a/core/os/os2/file_windows.odin
+++ b/core/os/os2/file_windows.odin
@@ -231,7 +231,7 @@ _read :: proc(f: ^File_Impl, p: []byte) -> (n: i64, err: Error) {
return 0, nil
}
- // TODO(bill): should this be moved to `_File` instead?
+ // TODO(bill): should this be moved to `File_Impl` instead?
BUF_SIZE :: 386
buf16: [BUF_SIZE]u16
buf8: [4*BUF_SIZE]u8
diff --git a/core/os/os2/path_windows.odin b/core/os/os2/path_windows.odin
index 68ce43c13..c93c929f2 100644
--- a/core/os/os2/path_windows.odin
+++ b/core/os/os2/path_windows.odin
@@ -139,10 +139,33 @@ can_use_long_paths: bool
@(init)
init_long_path_support :: proc() {
- // TODO(bill): init_long_path_support
- // ADD THIS SHIT
- // registry_path := win32.L(`Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled`)
can_use_long_paths = false
+
+ key: win32.HKEY
+ res := win32.RegOpenKeyExW(win32.HKEY_LOCAL_MACHINE, win32.L(`SYSTEM\CurrentControlSet\Control\FileSystem`), 0, win32.KEY_READ, &key)
+ defer win32.RegCloseKey(key)
+ if res != 0 {
+ return
+ }
+
+ value: u32
+ size := u32(size_of(value))
+ res = win32.RegGetValueW(
+ key,
+ nil,
+ win32.L("LongPathsEnabled"),
+ win32.RRF_RT_ANY,
+ nil,
+ &value,
+ &size,
+ )
+ if res != 0 {
+ return
+ }
+ if value == 1 {
+ can_use_long_paths = true
+ }
+
}
@(require_results)