MCPcopy Create free account
hub / github.com/GJDuck/e9patch / getDirname

Function getDirname

src/e9tool/e9misc.cpp:103–120  ·  view source on GitHub ↗

* Get the source directory name. */

Source from the content-addressed store, hash-verified

101 * Get the source directory name.
102 */
103const char *getDirname(const char *dir, const char *file, char *tmp,
104 size_t size)
105{
106 char *abs = (char *)getAbsname(dir, file, tmp, size);
107 if (abs == nullptr)
108 return nullptr;
109 char *last = strrchr((char *)abs, '/');
110 if (last == nullptr)
111 return nullptr;
112 size_t len = last-abs+1;
113 if (abs == file)
114 {
115 memcpy(tmp, file, len);
116 abs = tmp;
117 }
118 abs[len] = '\0';
119 return abs;
120}
121
122/*
123 * Get the source base name.

Callers 2

makeMatchValueFunction · 0.85
sendArgumentDataMetadataFunction · 0.85

Calls 2

getAbsnameFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected