From 1aa906cf21accf9d82b39340c1a7b5b54a9440e1 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Thu, 18 Sep 2014 09:24:24 +0200 Subject: + SFileAddListFile now returns proper error code if the file cannot be added. --- src/SFileListFile.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/SFileListFile.cpp') diff --git a/src/SFileListFile.cpp b/src/SFileListFile.cpp index ed549d1..3428bcc 100644 --- a/src/SFileListFile.cpp +++ b/src/SFileListFile.cpp @@ -452,12 +452,12 @@ static int SFileAddExternalListFile( int nError = ERROR_SUCCESS; // Open the external list file - if(SFileOpenFileEx(hMpq, szListFile, SFILE_OPEN_LOCAL_FILE, &hListFile)) - { - // Add the data from the listfile to MPQ - nError = SFileAddArbitraryListFile(ha, hListFile); - SFileCloseFile(hListFile); - } + if(!SFileOpenFileEx(hMpq, szListFile, SFILE_OPEN_LOCAL_FILE, &hListFile)) + return GetLastError(); + + // Add the data from the listfile to MPQ + nError = SFileAddArbitraryListFile(ha, hListFile); + SFileCloseFile(hListFile); return nError; } @@ -524,9 +524,9 @@ int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile) while(ha != NULL) { if(szListFile != NULL) - SFileAddExternalListFile(ha, hMpq, szListFile); + nError = SFileAddExternalListFile(ha, hMpq, szListFile); else - SFileAddInternalListFile(ha, hMpq); + nError = SFileAddInternalListFile(ha, hMpq); // Also, add three special files to the listfile: // (listfile) itself, (attributes) and (signature) -- cgit v1.2.3