Fixed up path_get_slash return value

This commit is contained in:
cold-brewed
2023-08-22 15:11:37 -04:00
parent 6f4a3ebb9e
commit f37474246b
4 changed files with 5 additions and 11 deletions

View File

@@ -3,6 +3,6 @@ extern char *path_get_filename(char *s);
extern char *path_get_extension(char *s);
extern void path_append_filename(char *dest, const char *s1, const char *s2);
extern void path_slash(char *path);
extern char *path_get_slash(char *path);
extern const char *path_get_slash(char *path);
extern void path_normalize(char *path);
extern int path_abs(char *path);

View File

@@ -304,16 +304,10 @@ path_slash(char *path)
path_normalize(path);
}
char *
const char *
path_get_slash(char *path)
{
auto len = strlen(path);
std::string ret = "";
if (path[len - 1] != '/')
ret = "/";
return (char *) ret.c_str();
return QString(path).endsWith("/") ? "" : "/";
}
void

View File

@@ -310,7 +310,7 @@ path_slash(char *path)
path_normalize(path);
}
char *
const char *
path_get_slash(char *path)
{
char *ret = "";

View File

@@ -739,7 +739,7 @@ path_slash(char *path)
}
/* Return a trailing (back)slash if necessary. */
char *
const char *
path_get_slash(char *path)
{
char *ret = "";