SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
saveaspathnormalizer.h File Reference
#include <QSet>
#include <QString>
Include dependency graph for saveaspathnormalizer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmmvis::SaveAsPathResult
 

Namespaces

namespace  openswmmvis
 

Functions

SaveAsPathResult openswmmvis::normalizeSaveAsPath (const QString &dialogPath, const QSet< QString > &writableExtensions)
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Save As dialog result canonicalization (Slice RA, Phase RA.1).

The Save As dialog can return paths with stacked extensions like model.inp.oswp (when the dialog's selectFile() pre-fill carries a .inp and the user then picks a .oswp filter without clearing the basename — see §R.1 of GUI_IMPLEMENTATION_PLAN.md). Downstream code in SWMMVis::onSaveAs uses QFileInfo::completeBaseName() which strips only the last extension, producing model.inp.inp for the .inp save and model.inp.oswp for the sidecar — both undesired.

normalizeSaveAsPath() collapses any <ext>.<ext> duplication where both halves are known writable kinds, then computes the canonical inpPath and isProject flag the way onSaveAs needs them. The helper is intentionally a pure function over the dialog string + a writable- extensions set so the unit test (test_saveaspathnormalizer.cpp) can exercise it without spinning up the dialog or FileFilterRegistry.