Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 859 Bytes

README.md

File metadata and controls

32 lines (27 loc) · 859 Bytes

nativefiledialog-odin

Odin bindings for the Native File Dialog Extended library.

Basic Usage

import nfd "./nativefiledialog"
import "core:fmt"

main :: proc() {
    nfd.Init()
    defer nfd.Quit()
    
    path: cstring
    filters := [2]nfd.Filter_Item { { "Source code", "c,cpp,cc" }, { "Headers", "h,hpp" } }
    args := nfd.Open_Dialog_Args {
        filter_list = raw_data(filters[:]),
        filter_count = len(filters)
    }
    
    result := nfd.OpenDialogU8_With(&path, &args)
    switch result {
        case .Okay: {
            fmt.println("Success!")
            fmt.println(path)
            nfd.FreePathU8(path)
        }
        case .Cancel: fmt.println("User pressed cancel.")
        case .Error: fmt.println("Error:", nfd.GetError())
    }
}