Integrating media paths to search for system directory in collections.

This commit is contained in:
Don Honerbrink 2015-02-25 17:08:54 -06:00
parent 55d014fb71
commit 49d2fd7c6a
3 changed files with 21 additions and 6 deletions

View File

@ -340,6 +340,12 @@ bool Configuration::GetPropertyAbsolutePath(std::string key, std::string &value)
}
void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std::string mediaType, std::string &value)
{
return GetMediaPropertyAbsolutePath(collectionName, mediaType, false, value);
}
void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std::string mediaType, bool system, std::string &value)
{
std::string key = "media." + collectionName + "." + mediaType;
@ -347,6 +353,7 @@ void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std
{
return;
}
std::string baseMediaPath;
if(!GetPropertyAbsolutePath("baseMediaPath", baseMediaPath))
{
@ -355,11 +362,11 @@ void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std
if(mediaType == "manufacturer")
{
value = baseMediaPath + "/_Manufacturer";
value = baseMediaPath + "/_manufacturer";
}
else
{
value = baseMediaPath + "/" + collectionName + "/" + mediaType);
value = baseMediaPath + "/" + collectionName + "/" + mediaType + "/system");
}
}

View File

@ -43,6 +43,7 @@ public:
bool PropertyPrefixExists(std::string key);
bool GetPropertyAbsolutePath(std::string key, std::string &value);
void GetMediaPropertyAbsolutePath(std::string collectionName, std::string mediaType, std::string &value);
void GetMediaPropertyAbsolutePath(std::string collectionName, std::string mediaType, bool system, std::string &value);
void GetCollectionAbsolutePath(std::string collectionName, std::string &value);
bool IsVerbose() const;
void SetVerbose(bool verbose);

View File

@ -199,18 +199,25 @@ void ReloadableMedia::ReloadTexture()
if(!LoadedComponent)
{
std::string imagePath;
Config.GetMediaPropertyAbsolutePath(GetCollectionName(), Type, imagePath);
Config.GetMediaPropertyAbsolutePath(GetCollectionName(), Type, false, imagePath);
ImageBuilder imageBuild;
LoadedComponent = imageBuild.CreateImage(imagePath, imageBasename, ScaleX, ScaleY);
if(!LoadedComponent)
{
Config.GetMediaPropertyAbsolutePath(imageBasename, Type, true, imagePath);
LoadedComponent = imageBuild.CreateImage(imagePath, imageBasename, ScaleX, ScaleY);
}
if (LoadedComponent != NULL)
{
LoadedComponent->AllocateGraphicsMemory();
GetBaseViewInfo()->SetImageWidth(LoadedComponent->GetBaseViewInfo()->GetImageWidth());
GetBaseViewInfo()->SetImageHeight(LoadedComponent->GetBaseViewInfo()->GetImageHeight());
LoadedComponent->AllocateGraphicsMemory();
GetBaseViewInfo()->SetImageWidth(LoadedComponent->GetBaseViewInfo()->GetImageWidth());
GetBaseViewInfo()->SetImageHeight(LoadedComponent->GetBaseViewInfo()->GetImageHeight());
}
}
if(!LoadedComponent && TextFallback)