mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 06:38:20 +00:00
Merge pull request #6456 from imp0s5ible/imp-file-mapping-fix
Fix #6455
This commit is contained in:
@@ -10,7 +10,14 @@ map_file :: proc{
|
||||
}
|
||||
|
||||
map_file_from_path :: proc(filename: string, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
|
||||
f, err := os.open(filename, os.O_RDWR)
|
||||
open_flags : os.File_Flags
|
||||
if .Read in flags {
|
||||
open_flags += {.Read}
|
||||
}
|
||||
if .Write in flags {
|
||||
open_flags += {.Write}
|
||||
}
|
||||
f, err := os.open(filename, open_flags)
|
||||
if err != nil {
|
||||
return nil, .Open_Failure
|
||||
}
|
||||
@@ -37,4 +44,4 @@ unmap_file :: proc(data: []byte) {
|
||||
if raw_data(data) != nil {
|
||||
_unmap_file(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user