}
-bool
-getProcessName(char *str, size_t size)
+Path
+getProcessName(void)
{
- char szProcessPath[PATH_MAX];
- char *lpProcessName;
- char *lpProcessExt;
-
- GetModuleFileNameA(NULL, szProcessPath, sizeof(szProcessPath)/sizeof(szProcessPath[0]));
+ Path path;
- lpProcessName = strrchr(szProcessPath, '\\');
- lpProcessName = lpProcessName ? lpProcessName + 1 : szProcessPath;
+ char *szProcessPath = path.buf(PATH_MAX);
- lpProcessExt = strrchr(lpProcessName, '.');
- if (lpProcessExt) {
- *lpProcessExt = '\0';
- }
+ DWORD nWritten = GetModuleFileNameA(NULL, szProcessPath, PATH_MAX);
- strncpy(str, lpProcessName, size);
+ path.truncate();
+ path.trimExtension();
+ path.trimDirectory();
- return true;
+ return path;
}
bool