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:
parent
12b816bcd6
commit
dd0d5df80b
|
@ -54,4 +54,9 @@ void AddExtensionIfMissing(std::string &name,const char * extension) {
|
|||
//If the extension(".????") is longer then 5 characters, it's probably part of the filename. If x == -1, wasn't found
|
||||
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);
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue