Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Jun 11, 2024
1 parent 87e11a8 commit 3460720
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
22 changes: 1 addition & 21 deletions Plugins/VGUI2Extension/exportfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,24 +418,4 @@ void InitWin32Stuffs(void)

g_MainWndProc = (WNDPROC)GetWindowLong(g_MainWnd, GWL_WNDPROC);
SetWindowLong(g_MainWnd, GWL_WNDPROC, (LONG)VID_MainWndProc);
}

void RemoveFileExtension(std::string& filePath)
{
// Find the last occurrence of '.'
size_t lastDotPosition = filePath.find_last_of(".");

// Check if the dot is part of a directory component rather than an extension
size_t lastPathSeparator = filePath.find_last_of("/\\");

if (lastDotPosition != std::string::npos) {
// Ensure the dot is after the last path separator
if (lastPathSeparator != std::string::npos && lastDotPosition < lastPathSeparator) {
return; // Dot is part of a directory name, not an extension
}
// Return the substring from the beginning to the dot
filePath = filePath.substr(0, lastDotPosition);
}

// No extension found, return the original path
}
}
4 changes: 1 addition & 3 deletions Plugins/VGUI2Extension/exportfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,4 @@ LRESULT WINAPI VID_MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara

void SDL_GetWindowSize(void* window, int* w, int* h);

void InitWin32Stuffs(void);

void RemoveFileExtension(std::string& filePath);;
void InitWin32Stuffs(void);

0 comments on commit 3460720

Please sign in to comment.