Added null progress notifier, optimized CResourceStore::BuildFromDirectory a little

This commit is contained in:
Aruki 2017-07-15 22:55:26 -06:00
parent a813c4c61c
commit bfe541a35d
4 changed files with 17 additions and 3 deletions

View File

@ -339,4 +339,5 @@ SOURCES += \
Resource/CResTypeInfo.cpp \
CompressionUtil.cpp \
IUIRelay.cpp \
GameProject\COpeningBanner.cpp
GameProject\COpeningBanner.cpp \
IProgressNotifier.cpp

View File

@ -303,9 +303,9 @@ bool CResourceStore::BuildFromDirectory(bool ShouldGenerateCacheFile)
for (auto Iter = ResourceList.begin(); Iter != ResourceList.end(); Iter++)
{
TString Path = *Iter;
TString RelPath = FileUtil::MakeRelative(Path, ResDir);
TString RelPath = Path.ChopFront( ResDir.Size() );
if (FileUtil::IsFile(Path) && Path.GetFileExtension() == "rsmeta")
if (FileUtil::IsFile(Path) && Path.EndsWith(".rsmeta"))
{
// Determine resource name
TString DirPath = RelPath.GetFileDirectory();

View File

@ -0,0 +1,3 @@
#include "IProgressNotifier.h"
CNullProgressNotifier *gpNullProgress = new CNullProgressNotifier();

View File

@ -63,4 +63,14 @@ protected:
virtual void UpdateProgress(const TString& rkTaskName, const TString& rkStepDesc, float ProgressPercent) = 0;
};
// Null progress notifier can be passed to functions that require a progress notifier if you don't want to use one.
class CNullProgressNotifier : public IProgressNotifier
{
public:
bool ShouldCancel() const { return false; }
protected:
void UpdateProgress(const TString&, const TString&, float) {}
};
extern CNullProgressNotifier *gpNullProgress;
#endif // IPROGRESSNOTIFIER_H