MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / getInterpPWD

Function getInterpPWD

SRC/runtime/commands/interpreter.cpp:242–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242const char *
243getInterpPWD(Tcl_Interp *interp)
244{
245 static char *pwd = 0;
246
247 if (pwd != 0)
248 delete[] pwd;
249
250#ifdef _TCL84
251 Tcl_Obj *cwd = Tcl_FSGetCwd(interp);
252 if (cwd != NULL) {
253 int length;
254 const char *objPWD = Tcl_GetStringFromObj(cwd, &length);
255 pwd = new char[length + 1];
256 strcpy(pwd, objPWD);
257 Tcl_DecrRefCount(cwd);
258 }
259#else
260 Tcl_DString buf;
261 const char *objPWD = Tcl_GetCwd(interp, &buf);
262
263 pwd = new char[strlen(objPWD) + 1];
264 strcpy(pwd, objPWD);
265
266 Tcl_DStringFree(&buf);
267#endif
268 return pwd;
269}
270
271int
272OPS_SourceCmd(ClientData dummy, /* Not used. */

Callers 4

TclCreateRecorderFunction · 0.50
TclPatternCommandFunction · 0.50
OPS_GetInterpPWDFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected