don't force .sigrok extension when saving session file

This commit is contained in:
Bert Vermeulen 2011-02-01 01:41:33 +01:00
parent b8c2f85f56
commit 4a1b18f86d
1 changed files with 3 additions and 9 deletions

View File

@ -147,18 +147,12 @@ int session_save(char *filename)
struct zip_source *versrc, *metasrc, *logicsrc; struct zip_source *versrc, *metasrc, *logicsrc;
int bufcnt, devcnt, tmpfile, ret, error, probecnt; int bufcnt, devcnt, tmpfile, ret, error, probecnt;
uint64_t samplerate; uint64_t samplerate;
char version[1], rawname[16], metafile[32], *newfn, *buf, *s; char version[1], rawname[16], metafile[32], *buf, *s;
newfn = g_malloc(strlen(filename) + 10);
strcpy(newfn, filename);
if (strstr(filename, ".sigrok") != filename+strlen(filename)-7)
strcat(newfn, ".sigrok");
/* Quietly delete it first, libzip wants replace ops otherwise. */ /* Quietly delete it first, libzip wants replace ops otherwise. */
unlink(newfn); unlink(filename);
if (!(zipfile = zip_open(newfn, ZIP_CREATE, &error))) if (!(zipfile = zip_open(filename, ZIP_CREATE, &error)))
return SR_ERR; return SR_ERR;
g_free(newfn);
/* "version" */ /* "version" */
version[0] = '1'; version[0] = '1';