#14538 Well path: Preserve renamed file well name without breaking legacy projects

Reverts the unconditional change from commit 74ffc822f2 and replaces it with
a safer fix: only skip re-initializing the well path name from the source
file on reload when a name has already been set. Older projects that never
serialized the well path Name field (e.g. TestCase_RFT_PLT/RegressionTest.rsp)
still get their name populated from the file on load, while renamed well
paths in newer projects keep their custom name across reloads.

Restores the RMS well round-trip test that verifies a renamed well path
name persists after save/reopen.
This commit is contained in:
Magne Sjaastad
2026-08-31 10:28:10 +02:00
parent 75ebd7f20b
commit e5c3e54227
@@ -138,8 +138,12 @@ bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImport
RifWellPathImporter::WellMetaData wellMetaData = RifWellPathImporter::readWellMetaData( filePath(), m_wellPathIndexInFile() );
// General well info
if ( initializeWellNamesFromFile )
if ( initializeWellNamesFromFile || name().isEmpty() )
{
// Initialize the well path and export names from the source file during first import, or if no name
// has been assigned yet (e.g. projects saved before the well path name was persisted). Subsequent data
// reloads of a named well path preserve the name stored in the project while continuing to refresh
// geometry and metadata.
setName( wellData.m_name );
}