MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_get_module_parent

Function my_get_module_parent

mysys_ssl/my_default.cc:1331–1359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329
1330
1331static const char *my_get_module_parent(char *buf, size_t size)
1332{
1333 char *last= NULL;
1334 char *end;
1335 if (!GetModuleFileName(NULL, buf, (DWORD) size))
1336 return NULL;
1337 end= strend(buf);
1338
1339 /*
1340 Look for the second-to-last \ in the filename, but hang on
1341 to a pointer after the last \ in case we're in the root of
1342 a drive.
1343 */
1344 for ( ; end > buf; end--)
1345 {
1346 if (*end == FN_LIBCHAR)
1347 {
1348 if (last)
1349 {
1350 /* Keep the last '\' as this works both with D:\ and a directory */
1351 end[1]= 0;
1352 break;
1353 }
1354 last= end;
1355 }
1356 }
1357
1358 return buf;
1359}
1360#endif /* __WIN__ */
1361
1362

Callers 1

init_default_directoriesFunction · 0.85

Calls 1

strendFunction · 0.85

Tested by

no test coverage detected