Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dumbasaroc opened this issue Mar 2, 2021 · 0 comments
Open

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

dumbasaroc opened this issue Mar 2, 2021 · 0 comments

Comments

@dumbasaroc
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant