Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::editor::FileDialogState Class Reference

Tracks the directory the user last browsed to and the most-recently opened/saved files, so the next dialog can seed a sensible starting directory and (on platforms without an OS recents list) an in-editor recent-files menu. More...

#include "donner/editor/FileDialogState.h"

Public Member Functions

 FileDialogState (std::size_t maxRecents=10)
std::optional< std::string > defaultDirectory (const std::optional< std::string > &currentFilePath) const
 Directory to seed the next dialog with.
void noteChosenPath (std::string_view path)
 Record that the user opened or saved path. Updates the remembered directory and pushes the file to the front of the recents list (de-duplicated, most-recent first, bounded by maxRecents).
const std::vector< std::string > & recentFiles () const
 Most-recently opened/saved files, newest first.
const std::optional< std::string > & lastDirectory () const
 Directory remembered from the last chosen file, if any.

Detailed Description

Tracks the directory the user last browsed to and the most-recently opened/saved files, so the next dialog can seed a sensible starting directory and (on platforms without an OS recents list) an in-editor recent-files menu.

Constructor & Destructor Documentation

◆ FileDialogState()

donner::editor::FileDialogState::FileDialogState ( std::size_t maxRecents = 10)
explicit
Parameters
maxRecentsMaximum number of remembered recent files.

Member Function Documentation

◆ defaultDirectory()

std::optional< std::string > donner::editor::FileDialogState::defaultDirectory ( const std::optional< std::string > & currentFilePath) const
nodiscard

Directory to seed the next dialog with.

Preference order: the directory of the last chosen file, then the parent directory of currentFilePath if one is open, then empty (let the OS pick its own default).

Parameters
currentFilePathPath of the document currently open, if any.

◆ noteChosenPath()

void donner::editor::FileDialogState::noteChosenPath ( std::string_view path)

Record that the user opened or saved path. Updates the remembered directory and pushes the file to the front of the recents list (de-duplicated, most-recent first, bounded by maxRecents).

Empty paths are ignored.


The documentation for this class was generated from the following file: