Skip to content
Snippets Groups Projects
Commit dd43e88f authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better algo to compute opt filename

parent ec3a4507
No related branches found
No related tags found
No related merge requests found
......@@ -383,6 +383,11 @@ int MergeFile(std::string fileName, bool warnIfMissing)
if(!status) Msg::Error("Error loading '%s'", fileName.c_str());
Msg::StatusBar(2, true, "Read '%s'", fileName.c_str());
// merge the associated option file if there is one
if(!StatFile(fileName + ".opt"))
MergeFile(fileName + ".opt");
return status;
}
......@@ -445,10 +450,6 @@ void OpenProject(std::string fileName)
// merge the file
MergeFile(fileName);
// merge the associated option file if there is one
if(!StatFile(fileName + ".opt"))
MergeFile(fileName + ".opt");
CTX::instance()->lock = 0;
#if defined(HAVE_FLTK)
......
......@@ -1991,9 +1991,6 @@ static void view_reload(int index)
p->setChanged(true);
FlGui::instance()->updateViews();
}
if(!StatFile(p->getData()->getFileName() + ".opt"))
MergeFile(p->getData()->getFileName() + ".opt");
}
}
......
......@@ -107,6 +107,8 @@ static void plugin_browser_cb(Fl_Widget *w, void *data)
static void add_scripting(GMSH_PostPlugin *p, PView *view)
{
if(!FlGui::instance()->plugins->record->value()) return;
std::string fileName;
int oldIndex = -1;
if(view){
for(int i = 0; i < p->getNbOptions(); i++){
......@@ -115,9 +117,12 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
p->getOption(i)->def = view->getIndex();
}
}
fileName = view->getData()->getFileName();
}
else
fileName = GModel::current()->getFileName();
std::string fileName = GModel::current()->getFileName() + ".opt";
fileName += + ".opt";
FILE *fp = fopen(fileName.c_str(), "a");
if(!fp){
Msg::Error("Could not open file '%s'", fileName.c_str());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment