HResourceUtilities.cpp 1.83 KB
//
//  HResourceUtilities.cpp
//  SteveMaggieCpp
//
//  Created by Katarzyna Kalinowska-Górska on 23.06.2017.
//
//

#include <stdio.h>
#include "HResourceUtilities.h"
#include "HJSONParseUtils.h"
#include "HValueStorage.h"
//#include "ResourceDownloader_cpp.h"
#include "HResourcesConfig.h"

#define RESOURCES_LOAD_FROM_ASSETS
//#define FORCE_REDOWNLOAD_RESOURCES


std::string HResourceUtilities::getDownloadedResourcesPath(bool deviceDependentFiles)
{
#ifdef RESOURCES_LOAD_FROM_ASSETS
    return "";
#endif
//    std::string resDownloadDir = ResourceDownloader_getResourceDownloadDirectoryPath();
//
//    if(deviceDependentFiles){
//        return resDownloadDir + "/" + this->getDeviceSpecificFolderName();
//    }
//
//    return resDownloadDir + "/" + HResourcesConfig::UNIVERSAL_RESOURCES_FOLDER_NAME;
}

std::string HResourceUtilities::getFullPathForDownloadedFile(const std::string& path, bool isDeviceDependent)
{
#ifdef RESOURCES_LOAD_FROM_ASSETS
    return path;
#endif
//    std::string resDownloadDir = this->getDownloadedResourcesPath(isDeviceDependent);
//    return resDownloadDir + "/" + path;
}

std::vector< std::string> HResourceUtilities::getFullPathsForDownloadedFiles(const std::vector< std::string>& paths, bool areDeviceDependent)
{
    std::vector< std::string> fullPaths;
    fullPaths.reserve(paths.size());
    for(const auto& path : paths){
        fullPaths.push_back(this->getFullPathForDownloadedFile(path, areDeviceDependent));
    }
    return fullPaths;
}
/*
std::vector<std::string> HResourceUtilities::getFullPathsForDownloadedFiles(const std::vector<std::string>& paths, bool areDeviceDependent)
{
    std::vector<std::string> fullPaths;
    fullPaths.reserve(paths.size());
    for(const auto& path : paths){
        fullPaths.push_back(this->getFullPathForDownloadedFile(path, areDeviceDependent));
    }
    return fullPaths;
}
*/