Skip to content

Commit 107f012

Browse files
committed
Enable the use of ECFLOW_SHARED_DIR
ECFLOW_SHARED_DIR defines the location of the shared resource files, and allow the very useful runnning/debugging of ecflow_ui.x straight from the build directory. If ECFLOW_SHARED_DIR is not defined, the default behaviour is, as before, to use the install prefix determined at compile time.
1 parent aa0e3bd commit 107f012

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Viewer/libViewer/src/DirectoryHandler.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,19 @@ void DirectoryHandler::init(const std::string& exeStr) {
116116
// will use the value of the ECFLOW_SHARED_DIR macro to get
117117
// the location of the "share/ecflow" dir.
118118
if (!fs::exists(exePath)) {
119-
fs::path shareDir(ECFLOW_SHARED_DIR);
119+
fs::path shareDir;
120+
if (auto* var = getenv("ECFLOW_SHARED_DIR"); var) {
121+
shareDir = var;
122+
UiLog().warn() << "Executable path does not exist. Used ECFLOW_SHARED_DIR env variable to find share dir: "
123+
<< shareDir.c_str();
124+
}
125+
else {
126+
shareDir = ECFLOW_SHARED_DIR;
127+
UiLog().warn()
128+
<< "Executable path does not exist. Used default ECFLOW_SHARED_DIR location to find share dir: "
129+
<< shareDir.c_str();
130+
}
131+
120132
if (!fs::exists(shareDir)) {
121133
UserMessage::message(
122134
UserMessage::ERROR,

0 commit comments

Comments
 (0)