MCPcopy Create free account
hub / github.com/NetHack/NetHack / exepath

Function exepath

util/recover.c:437–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435char exepathbuf[EXEPATHBUFSZ];
436
437char *
438exepath(char *str)
439{
440 char *tmp, *tmp2;
441 int bsize;
442
443 if (!str)
444 return (char *) 0;
445 nhUse(bsize);
446 bsize = EXEPATHBUFSZ;
447 tmp = exepathbuf;
448#if !defined(WIN32)
449 strcpy(tmp, str);
450#else
451#if defined(WIN_CE)
452 {
453 TCHAR wbuf[EXEPATHBUFSZ];
454 GetModuleFileName((HANDLE) 0, wbuf, EXEPATHBUFSZ);
455 NH_W2A(wbuf, tmp, bsize);
456 }
457#else
458 *(tmp + GetModuleFileName((HANDLE) 0, tmp, bsize)) = '\0';
459#endif
460#endif
461 tmp2 = strrchr(tmp, PATH_SEPARATOR);
462 if (tmp2)
463 *tmp2 = '\0';
464 return tmp;
465}
466#endif /* EXEPATH */
467
468#ifdef WIN_CE

Callers 1

mainFunction · 0.70

Calls 1

strrchrFunction · 0.85

Tested by

no test coverage detected