mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-19 16:04:31 +03:00
[project @ 2005-07-16 14:02:15 by adrianl]
Update sprite name when saving svn path=/import/netsurf/; revision=1795
This commit is contained in:
parent
c383813921
commit
81a39c3075
@ -704,9 +704,13 @@ bool ro_gui_save_content(struct content *c, char *path)
|
||||
|
||||
bool ro_gui_save_complete(struct content *c, char *path)
|
||||
{
|
||||
osspriteop_header *sprite;
|
||||
char name[12];
|
||||
char buf[256];
|
||||
FILE *fp;
|
||||
os_error *error;
|
||||
size_t len;
|
||||
char *dot;
|
||||
|
||||
/* Create dir */
|
||||
error = xosfile_create_dir(path, 0);
|
||||
@ -735,6 +739,20 @@ bool ro_gui_save_complete(struct content *c, char *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Make sure the sprite name matches the directory name, because
|
||||
the user may have renamed the directory since we created the
|
||||
thumbnail sprite */
|
||||
|
||||
dot = strrchr(path, '.');
|
||||
if (dot) dot++; else dot = path;
|
||||
len = strlen(dot);
|
||||
if (len >= 12) len = 12;
|
||||
|
||||
sprite = (osspriteop_header*)((byte*)saveas_area + saveas_area->first);
|
||||
memcpy(name, sprite->name, 12); /* remember original name */
|
||||
memcpy(sprite->name, dot, len);
|
||||
memset(sprite->name + len, 0, 12 - len);
|
||||
|
||||
/* Create !Sprites */
|
||||
snprintf(buf, sizeof buf, "%s.!Sprites", path);
|
||||
|
||||
@ -746,6 +764,9 @@ bool ro_gui_save_complete(struct content *c, char *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* restore sprite name in case the save fails and we need to try again */
|
||||
memcpy(sprite->name, name, 12);
|
||||
|
||||
return save_complete(c, path);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user