pthom / imgui_bundle

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!
https://pthom.github.io/imgui_bundle/
MIT License
590 stars 62 forks source link

Ability to specify absolute path for `runner_params.ini_filename` #181

Closed kuchi closed 4 months ago

kuchi commented 4 months ago

Is there a way I can specify the absolute path for the runner_params.ini_filename.

I need it to always go into an application setting directory by my application sometimes changes the current working directory so I get inconsistent saving of the ini file when that happens.

pthom commented 4 months ago

See https://pthom.github.io/hello_imgui/book/doc_params.html#full-params

   // `iniFolderType`: _IniFolderType, default = IniFolderType::CurrentFolder_
    // Sets the folder where imgui will save its params.
    // (possible values are:
    //     CurrentFolder, AppUserConfigFolder, DocumentsFolder,
    //     HomeFolder, TempFolder, AppExecutableFolder)
    // AppUserConfigFolder is
    //     [Home]/AppData/Roaming under Windows,
    //     ~/.config under Linux,
    //     ~/Library/Application Support under macOS
    IniFolderType iniFolderType = IniFolderType::CurrentFolder;
    // `iniFilename`: _string, default = ""_
    // Sets the ini filename under which imgui will save its params.
    // Its path is relative to the path given by iniFolderType, and can include
    // a subfolder (which will be created if needed).
    // If iniFilename empty, then it will be derived from
    // appWindowParams.windowTitle
    // (if both are empty, the ini filename will be imgui.ini).
    std::string iniFilename = "";  // relative to iniFolderType
    // `iniFilename_useAppWindowTitle`: _bool, default = true_.
    // Shall the iniFilename be derived from appWindowParams.windowTitle (if not empty)
    bool iniFilename_useAppWindowTitle = true;
pthom commented 4 months ago

So, there is currently no way to specify an absolute path, but by using a path relative to AppExecutableFolder you may be able to get what you want

kuchi commented 4 months ago

Thanks so much. This is great and works perfect. I can do it relative to the user directory. I had noticed this variable but I wasn't certain what is was doing. I should have looked further into the code.