summaryrefslogtreecommitdiff
path: root/desktop/save_complete.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-07-09 19:45:44 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-07-09 19:45:44 +0000
commitd6eb28d5deef18c9b3fdb953553705b182ea8403 (patch)
tree4f1b364a89918328b3b83193f07896d49225e354 /desktop/save_complete.c
parentbffa2b64dee70c29d0b16dcfe9ecde7c46f4f393 (diff)
downloadnetsurf-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 'desktop/save_complete.c')
-rw-r--r--desktop/save_complete.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 88fe31560..19c1696d6 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -759,21 +759,19 @@ void save_complete_list_dump(void)
bool save_complete_inventory(const char *path,
struct save_complete_entry *list)
{
- char urlpath[256];
+ char fullpath[256];
FILE *fp;
- char *pathstring, *standardpath = (path[0] == '/') ?
- (char *)(path + 1) : (char *)path;
struct save_complete_entry *entry;
+ bool error;
- snprintf(urlpath, sizeof urlpath, "file:///%s/Inventory",
- standardpath);
- pathstring = url_to_path(urlpath);
- if (pathstring == NULL) {
+ strncpy(fullpath, path, sizeof fullpath);
+ error = path_add_part(fullpath, sizeof fullpath, path);
+
+ if (error == false) {
warn_user("NoMemory", 0);
return false;
}
- fp = fopen(pathstring, "w");
- free(pathstring);
+ fp = fopen(fullpath, "w");
if (!fp) {
LOG(("fopen(): errno = %i", errno));
warn_user("SaveError", strerror(errno));