getOpenFileName

Gets a file name for an open or save operation, calling your onOK function when the user has selected one. This function may or may not block depending on the operating system, you MUST assume it will complete asynchronously.

  1. void getOpenFileName(Window owner, void delegate(string) onOK, string prefilledName, string[] filters, void delegate() onCancel, string initialDirectory)
    void
    getOpenFileName
    (,
    void delegate
    (
    string
    )
    onOK
    ,
    string prefilledName = null
    ,
    string[] filters = null
    ,
    void delegate
    ()
    onCancel = null
    ,
    string initialDirectory = null
    )
  2. void getOpenFileName(void delegate(string) onOK, string prefilledName, string[] filters, void delegate() onCancel, string initialDirectory)

Meta

History

onCancel was added November 6, 2021.

The dialog itself on Linux was modified on December 2, 2021 to include a directory picker in addition to the command line completion view.

The initialDirectory argument was added November 9, 2022 (dub v10.10)

The owner argument was added September 29, 2024. The overloads without this argument are likely to be deprecated in the next major version.

Future directions

I want to add some kind of custom preview and maybe thumbnail thing in the future, at least on Linux, maybe on Windows too.