Use absolute path when caching
This commit is contained in:
parent
c85425c473
commit
9aae773e91
@ -264,7 +264,8 @@ ShaderFilesManager::SharedShader ShaderFilesManager::getShaderFile
|
||||
{
|
||||
const std::string full_path = (file.find('/') != std::string::npos ||
|
||||
file.find('\\') != std::string::npos) ?
|
||||
file : file_manager->getShader(file);
|
||||
file : std::string(file_manager->getFileSystem()->getAbsolutePath
|
||||
(file_manager->getShadersDir().c_str()).c_str()) + file;
|
||||
// found in cache
|
||||
auto it = m_shader_files_loaded.find(full_path);
|
||||
if (it != m_shader_files_loaded.end())
|
||||
|
@ -389,7 +389,13 @@ std::string SPShaderManager::getShaderFullPath(const std::string& name)
|
||||
{
|
||||
return cur_location;
|
||||
}
|
||||
return file_manager->getAssetChecked(FileManager::SHADER, name);
|
||||
cur_location = file_manager->getAssetChecked(FileManager::SHADER, name);
|
||||
if (cur_location.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return file_manager->getFileSystem()->getAbsolutePath(cur_location.c_str())
|
||||
.c_str();
|
||||
} // getShaderFullPath
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -533,7 +539,7 @@ void SPShaderManager::addPrefilledTexturesToShader(SPShader* s,
|
||||
void SPShaderManager::loadSPShaders(const std::string& directory_name)
|
||||
{
|
||||
std::set<std::string> shaders;
|
||||
file_manager->listFiles(shaders, directory_name, true/*make_full_path*/);
|
||||
file_manager->listFiles(shaders, directory_name);
|
||||
for (auto it = shaders.begin(); it != shaders.end();)
|
||||
{
|
||||
if ((*it).find("sps") == std::string::npos ||
|
||||
@ -551,10 +557,11 @@ void SPShaderManager::loadSPShaders(const std::string& directory_name)
|
||||
return;
|
||||
}
|
||||
|
||||
m_shader_directory = directory_name;
|
||||
m_shader_directory = file_manager->getFileSystem()->getAbsolutePath
|
||||
(directory_name.c_str()).c_str();
|
||||
for (const std::string& file_name : shaders)
|
||||
{
|
||||
loadEachShader(file_name);
|
||||
loadEachShader(m_shader_directory + file_name);
|
||||
}
|
||||
m_shader_directory = "";
|
||||
} // loadSPShaders
|
||||
|
Loading…
Reference in New Issue
Block a user