mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
#9455 libecl: Fix summary restart absolute path issues
Test for absolute path before other logic during extraction of summary restart file path.
This commit is contained in:
parent
4fea00afbf
commit
daa8d7305b
30
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
30
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
@ -882,7 +882,6 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi
|
||||
|
||||
restart_base = util_alloc_strip_copy( tmp_base );
|
||||
if (strlen(restart_base)) { /* We ignore the empty ones. */
|
||||
char * smspec_header;
|
||||
|
||||
/*
|
||||
The conditional block here is to support the following situation:
|
||||
@ -904,18 +903,23 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string path = ecl::util::path::dirname( ecl_smspec->header_file );
|
||||
smspec_header = ecl_util_alloc_exfilename( path.c_str() , restart_base , ECL_SUMMARY_HEADER_FILE , ecl_smspec->formatted , 0);
|
||||
if (smspec_header) {
|
||||
if (!util_same_file(smspec_header , ecl_smspec->header_file.c_str())) /* Restart from the current case is ignored. */ {
|
||||
if (util_is_abs_path(restart_base))
|
||||
ecl_smspec->restart_case = restart_base;
|
||||
else {
|
||||
char * tmp_path = util_alloc_filename( path.c_str() , restart_base , NULL );
|
||||
char * abs_path = util_alloc_abs_path(tmp_path);
|
||||
ecl_smspec->restart_case = abs_path;
|
||||
free( abs_path );
|
||||
free( tmp_path );
|
||||
if (util_is_abs_path(restart_base)) {
|
||||
ecl_smspec->restart_case = restart_base;
|
||||
}
|
||||
else {
|
||||
std::string path = ecl::util::path::dirname(ecl_smspec->header_file);
|
||||
char* smspec_header = ecl_util_alloc_exfilename( path.c_str() , restart_base , ECL_SUMMARY_HEADER_FILE , ecl_smspec->formatted , 0);
|
||||
if (smspec_header) {
|
||||
if (!util_same_file(smspec_header , ecl_smspec->header_file.c_str())) /* Restart from the current case is ignored. */ {
|
||||
if (util_is_abs_path(restart_base))
|
||||
ecl_smspec->restart_case = restart_base;
|
||||
else {
|
||||
char * tmp_path = util_alloc_filename( path.c_str() , restart_base , NULL );
|
||||
char * abs_path = util_alloc_abs_path(tmp_path);
|
||||
ecl_smspec->restart_case = abs_path;
|
||||
free( abs_path );
|
||||
free( tmp_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
free( smspec_header );
|
||||
|
Loading…
Reference in New Issue
Block a user