mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Output error msg when object file can't be opened
In rgbasm, output a fatal error if the destination object file can't be opened. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -522,31 +522,36 @@ void out_WriteObject(void)
|
|||||||
|
|
||||||
addexports();
|
addexports();
|
||||||
|
|
||||||
|
/* If no path specified, don't write file */
|
||||||
|
if (tzObjectname == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
f = fopen(tzObjectname, "wb");
|
f = fopen(tzObjectname, "wb");
|
||||||
if (f != NULL) {
|
if (f == NULL)
|
||||||
struct PatchSymbol *pSym;
|
fatalerror("Couldn't write file '%s'\n", tzObjectname);
|
||||||
struct Section *pSect;
|
|
||||||
|
|
||||||
fwrite(RGBDS_OBJECT_VERSION_STRING, 1,
|
struct PatchSymbol *pSym;
|
||||||
strlen(RGBDS_OBJECT_VERSION_STRING), f);
|
struct Section *pSect;
|
||||||
|
|
||||||
fputlong(countsymbols(), f);
|
fwrite(RGBDS_OBJECT_VERSION_STRING, 1,
|
||||||
fputlong(countsections(), f);
|
strlen(RGBDS_OBJECT_VERSION_STRING), f);
|
||||||
|
|
||||||
pSym = pPatchSymbols;
|
fputlong(countsymbols(), f);
|
||||||
while (pSym) {
|
fputlong(countsections(), f);
|
||||||
writesymbol(pSym->pSymbol, f);
|
|
||||||
pSym = pSym->pNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
pSect = pSectionList;
|
pSym = pPatchSymbols;
|
||||||
while (pSect) {
|
while (pSym) {
|
||||||
writesection(pSect, f);
|
writesymbol(pSym->pSymbol, f);
|
||||||
pSect = pSect->pNext;
|
pSym = pSym->pNext;
|
||||||
}
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pSect = pSectionList;
|
||||||
|
while (pSect) {
|
||||||
|
writesection(pSect, f);
|
||||||
|
pSect = pSect->pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user