no error on missing init file

This commit is contained in:
James Cherry
2020-11-30 08:05:50 -07:00
parent 1b499974a0
commit 4ed9f0e731
3 changed files with 18 additions and 5 deletions

View File

@@ -20,7 +20,6 @@
#include <tcl.h>
#include "StaConfig.hh" // STA_VERSION
#include "StringUtil.hh"
#include "Sta.hh"
@@ -28,15 +27,16 @@ namespace sta {
extern const char *tcl_inits[];
}
using std::string;
using sta::stringEq;
using sta::findCmdLineFlag;
using sta::Sta;
using sta::initSta;
using sta::evalTclInit;
using sta::stringPrintTmp;
using sta::sourceTclFile;
using sta::parseThreadsArg;
using sta::tcl_inits;
using sta::is_regular_file;
// Swig uses C linkage for init functions.
extern "C" {
@@ -116,9 +116,11 @@ staTclAppInit(int argc,
Tcl_Eval(interp, "sta::show_splash");
if (!findCmdLineFlag(argc, argv, "-no_init")) {
char *init_path = stringPrintTmp("[file join $env(HOME) %s]",
init_filename);
sourceTclFile(init_path, true, true, interp);
string init_path = getenv("HOME");
init_path += "/";
init_path += init_filename;
if (is_regular_file(init_path.c_str()))
sourceTclFile(init_path.c_str(), true, true, interp);
}
bool exit_after_cmd_file = findCmdLineFlag(argc, argv, "-exit");