diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-07-09 19:45:44 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-07-09 19:45:44 +0000 |
commit | d6eb28d5deef18c9b3fdb953553705b182ea8403 (patch) | |
tree | 4f1b364a89918328b3b83193f07896d49225e354 /gtk/gtk_gui.c | |
parent | bffa2b64dee70c29d0b16dcfe9ecde7c46f4f393 (diff) | |
download | netsurf-d6eb28d5deef18c9b3fdb953553705b182ea8403.tar.gz netsurf-d6eb28d5deef18c9b3fdb953553705b182ea8403.tar.bz2 |
Replace unnecessarily complicated path concatenation with something simpler and
easily adaptable to different platform path structures.
svn path=/trunk/netsurf/; revision=10621
Diffstat (limited to 'gtk/gtk_gui.c')
-rw-r--r-- | gtk/gtk_gui.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c index 79391ab4f..2470f30b5 100644 --- a/gtk/gtk_gui.c +++ b/gtk/gtk_gui.c @@ -978,3 +978,22 @@ char *filename_from_path(char *path) return strdup(leafname); } + +/** + * Add a path component/filename to an existing path + * + * \param path buffer containing path + free space + * \param length length of buffer "path" + * \param newpart string containing path component to add to path + * \return true on success + */ + +bool path_add_part(char *path, int length, char *newpart) +{ + if(path[strlen(path)] != '/') + strncat(path, "/", length); + + strncat(path, newpart, length); + + return true; +} |