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

fix relative path

parent f65aab18
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,7 @@ void add_infile(std::string text, std::string fileName, bool deleted_something) ...@@ -25,8 +25,7 @@ void add_infile(std::string text, std::string fileName, bool deleted_something)
// make sure we don't add stuff in a non-geo file // make sure we don't add stuff in a non-geo file
if(!CTX::instance()->expertMode) { if(!CTX::instance()->expertMode) {
std::vector<std::string> split = SplitFileName(fileName); std::vector<std::string> split = SplitFileName(fileName);
std::string ext = split[2]; if(split[2].size() && split[2] != ".geo" && split[2] != ".GEO"){
if(ext.size() && ext != ".geo" && ext != ".GEO"){
std::ostringstream sstream; std::ostringstream sstream;
sstream << sstream <<
"A scripting command is going to be appended to a non-`.geo' file.\n\n" "A scripting command is going to be appended to a non-`.geo' file.\n\n"
...@@ -53,7 +52,7 @@ void add_infile(std::string text, std::string fileName, bool deleted_something) ...@@ -53,7 +52,7 @@ void add_infile(std::string text, std::string fileName, bool deleted_something)
Msg::Error("Unable to open file '%s'", newFileName.c_str()); Msg::Error("Unable to open file '%s'", newFileName.c_str());
return; return;
} }
fprintf(fp, "Merge \"%s\";\n%s\n", fileName.c_str(), text.c_str()); fprintf(fp, "Merge \"%s\";\n%s\n", (split[1] + split[2]).c_str(), text.c_str());
fclose(fp); fclose(fp);
OpenProject(newFileName); OpenProject(newFileName);
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment