Fix PiStorm GUI for source paths

If a path was used as source it was appended to the destination, which
most of the time caused an error. This is because the filename was
isolated but then not used.
This commit is contained in:
Andrew Hutchings
2021-06-29 19:50:42 +01:00
parent fe7f7c2965
commit b86f3b6dcb
3 changed files with 9 additions and 4 deletions

View File

@@ -19,7 +19,7 @@
extern unsigned int pistorm_base_addr;
struct ReqToolsBase *ReqToolsBase;
#define VERSION "v0.3.4"
#define VERSION "v0.3.5"
#define button1w 54
#define button1h 11
@@ -668,19 +668,24 @@ int main()
{
fname = GetFileValue_buf;
}
else
{
// Remove leading slash
fname++;
}
char *destfile = malloc(256);
// Turns out WB doesn't like DF0:/filename.ext
if (DestinationValue_buf[(strlen(DestinationValue_buf) - 1)] == ':')
{
snprintf(destfile, 255, "%s%s", DestinationValue_buf, GetFileValue_buf);
snprintf(destfile, 255, "%s%s", DestinationValue_buf, fname);
}
else if (!strlen(DestinationValue_buf))
{
snprintf(destfile, 255, "%s", GetFileValue_buf);
snprintf(destfile, 255, "%s", fname);
}
else
{
snprintf(destfile, 255, "%s/%s", DestinationValue_buf, GetFileValue_buf);
snprintf(destfile, 255, "%s/%s", DestinationValue_buf, fname);
}
BPTR fh = Open(destfile, MODE_NEWFILE);
if (!fh)

Binary file not shown.