mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-22 08:49:46 +01:00
Minor visual cleanup of endsWith
This commit is contained in:
parent
b217fec3aa
commit
f422d02dcd
1 changed files with 17 additions and 4 deletions
|
@ -79,8 +79,17 @@ bool compare_nocase (std::string first, std::string second)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool endsWith(const std::string& str, const std::string& suffix) {
|
static bool endsWith(const std::string& str, const std::string& suffix)
|
||||||
return str.size() >= suffix.size() && 0 == str.compare(str.size()-suffix.size(), suffix.size(), suffix);
|
{
|
||||||
|
if (str.size() < suffix.size())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return str.compare(
|
||||||
|
str.size() - suffix.size(),
|
||||||
|
suffix.size(),
|
||||||
|
suffix
|
||||||
|
) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_all(std::string& str, const std::string& from, const std::string& to)
|
void replace_all(std::string& str, const std::string& from, const std::string& to)
|
||||||
|
@ -1651,9 +1660,13 @@ void editorclass::load(std::string& _path)
|
||||||
std::string dirpath = "levels/" + _path.substr(7,_path.size()-14) + "/";
|
std::string dirpath = "levels/" + _path.substr(7,_path.size()-14) + "/";
|
||||||
std::string zip_path;
|
std::string zip_path;
|
||||||
const char* cstr = PHYSFS_getRealDir(_path.c_str());
|
const char* cstr = PHYSFS_getRealDir(_path.c_str());
|
||||||
if (cstr) zip_path = cstr;
|
|
||||||
|
if (cstr) {
|
||||||
|
zip_path = cstr;
|
||||||
|
}
|
||||||
|
|
||||||
if (cstr && FILESYSTEM_directoryExists(zippath.c_str())) {
|
if (cstr && FILESYSTEM_directoryExists(zippath.c_str())) {
|
||||||
printf("Custom asset directory exists at %s\n",zippath.c_str());
|
printf("Custom asset directory exists at %s\n", zippath.c_str());
|
||||||
FILESYSTEM_mount(zippath.c_str());
|
FILESYSTEM_mount(zippath.c_str());
|
||||||
graphics.reloadresources();
|
graphics.reloadresources();
|
||||||
music.init();
|
music.init();
|
||||||
|
|
Loading…
Reference in a new issue