mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
RTech: add param to LoadFromFile for parse failures
Gets set if parsing failed.
This commit is contained in:
parent
1909ad63ab
commit
abe5578557
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static Node_t* LoadFromBuffer(const char* pszBufferName, char* pBuffer, eFieldType rootType);
|
static Node_t* LoadFromBuffer(const char* pszBufferName, char* pBuffer, eFieldType rootType);
|
||||||
static Node_t* LoadFromFile(const char* pszFilePath, const char* pPathID = nullptr);
|
static Node_t* LoadFromFile(const char* pszFilePath, const char* pPathID = nullptr, bool* parseFailure = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ RSON::Node_t* RSON::LoadFromBuffer(const char* pszBufferName, char* pBuffer, RSO
|
|||||||
// *pPathID -
|
// *pPathID -
|
||||||
// Output : pointer to RSON object on success, nullptr otherwise
|
// Output : pointer to RSON object on success, nullptr otherwise
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
RSON::Node_t* RSON::LoadFromFile(const char* pszFilePath, const char* pPathID)
|
RSON::Node_t* RSON::LoadFromFile(const char* pszFilePath, const char* pPathID, bool* parseFailure)
|
||||||
{
|
{
|
||||||
FileHandle_t file = FileSystem()->Open(pszFilePath, "rt", pPathID);
|
FileHandle_t file = FileSystem()->Open(pszFilePath, "rt", pPathID);
|
||||||
|
|
||||||
@ -36,7 +36,10 @@ RSON::Node_t* RSON::LoadFromFile(const char* pszFilePath, const char* pPathID)
|
|||||||
FileSystem()->Close(file);
|
FileSystem()->Close(file);
|
||||||
|
|
||||||
fileBuf[nRead] = '\0';
|
fileBuf[nRead] = '\0';
|
||||||
|
|
||||||
RSON::Node_t* node = RSON::LoadFromBuffer(pszFilePath, fileBuf.get(), eFieldType::RSON_OBJECT);
|
RSON::Node_t* node = RSON::LoadFromBuffer(pszFilePath, fileBuf.get(), eFieldType::RSON_OBJECT);
|
||||||
|
|
||||||
|
if (!node && parseFailure)
|
||||||
|
*parseFailure = true;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user