Skip to content

"Are You Sure" Modal when saving over already existing file #6

Open

Description

@dumbasaroc

I'm not sure if this is planned or not, but a suggestion I'd have for this project is a modal popup specifically during the "Save" version of the dialog. If the user tries to save over a file that already exists, tested likely through an std::ios::in std::fstream, the file dialog opens a confirmation window asking the user if they want to overwrite that file.

Hypothetically speaking, this could probably be cleanly implemented into the FileDialog::m_finalize function:

/* ERRONEOUS DETAIL REMOVED */
if (m_type == IFD_DIALOG_SAVE) {
	// add the extension
	if (m_filterSelection < m_filterExtensions.size() && m_filterExtensions[m_filterSelection].size() > 0) {
		if (!m_result.back().has_extension()) {
			std::string extAdd = m_filterExtensions[m_filterSelection][0];
			m_result.back().replace_extension(extAdd);
		}
	}

	std::fstream m_checkfile;
	m_checkfile.open(/*filename here*/, std::ios::in);
	if (m_checkfile.is_open())
	{
		m_checkfile.close();
		ImGui::OpenPopup("OnOverwriteFilePopup");
		return false
	}
}
/* ... */

I really think that this would drastically increase usability of the product, as users wouldn't be accidentally overwriting files that already existed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions