Skip to content

Commit

Permalink
Remove multiple slashes if they occur on the end of a path.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed May 5, 2019
1 parent 2397b51 commit 36f6152
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mz_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 36f6152

Please sign in to comment.