Remove multiple slashes if they occur on the end of a path.

This commit is contained in:
Nathan Moinvaziri 2019-05-05 08:19:14 -07:00
parent 2397b51366
commit 36f61523a3

11
mz_os.c
View File

@ -55,8 +55,15 @@ int32_t mz_path_append_slash(char *path, int32_t max_path)
int32_t mz_path_remove_slash(char *path)
{
int32_t path_len = (int32_t)strlen(path);
if (path[path_len - 1] == '\\' && path[path_len - 1] == '/')
path[path_len - 1] = 0;
while (path_len > 0)
{
if (path[path_len - 1] == '\\' && path[path_len - 1] == '/')
path[path_len - 1] = 0;
else
break;
path_len -= 1;
}
return MZ_OK;
}