Add a GetPath() function to common.cpp since there seems to be a lot of variations of that code floating around the codebase.

This commit is contained in:
adelikat 2010-05-07 02:06:49 +00:00
parent 12b816bcd6
commit dd0d5df80b
2 changed files with 6 additions and 0 deletions

View File

@ -55,3 +55,8 @@ void AddExtensionIfMissing(std::string &name,const char * extension) {
if ((x < (name.size() - 6)) || (x == -1))
name.append(extension);
}
std::string GetPath(std::string filename)
{
return filename.substr(0,filename.find_last_of("/\\") + 1);
}

View File

@ -54,4 +54,5 @@ void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX,
void WindowBoundsCheckNoResize(int &windowPosX, int &windowPosY, long windowRight);
void AddExtensionIfMissing(char * name,unsigned int maxsize,const char * extension);
void AddExtensionIfMissing(std::string &name,const char * extension);
std::string GetPath(std::string filename);
#endif