Fix the wrong "misuse"
Now you can play hot.ogg
This commit is contained in:
parent
5999e83cba
commit
7b571de395
@ -618,10 +618,10 @@ void Material::initCustomSFX(const XMLNode *sfx)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// The directory for the track was added to the model search path
|
// The directory for the track was added to the model search path
|
||||||
// so just misuse the getModelFile function
|
// so just misuse the searchModel function
|
||||||
const std::string full_path = file_manager->getAsset(FileManager::MODEL,
|
std::string path = file_manager->searchModel(filename);
|
||||||
filename);
|
path = StringUtils::getPath(path);
|
||||||
SFXBuffer* buffer = SFXManager::get()->loadSingleSfx(sfx, full_path);
|
SFXBuffer* buffer = SFXManager::get()->loadSingleSfx(sfx, path);
|
||||||
|
|
||||||
if (buffer != NULL)
|
if (buffer != NULL)
|
||||||
{
|
{
|
||||||
|
@ -601,14 +601,14 @@ bool FileManager::findFile(std::string& full_path,
|
|||||||
return false;
|
return false;
|
||||||
} // findFile
|
} // findFile
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Tries to find the specified file in any of the given search paths.
|
/** Tries to find the specified file in any of the given search paths.
|
||||||
* \param full_path On return contains the full path of the file, or
|
* \param full_path On return contains the full path of the file, or
|
||||||
* "" if the file is not found.
|
* "" if the file is not found.
|
||||||
* \param file_name The name of the file to look for.
|
* \param file_name The name of the file to look for.
|
||||||
* \param search_path The list of paths to search for the file.
|
* \param search_path The list of paths to search for the file.
|
||||||
* \return True if the file is found, false otherwise.
|
* \return True if the file is found, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool FileManager::findFile(std::string& full_path,
|
bool FileManager::findFile(std::string& full_path,
|
||||||
const std::string& file_name,
|
const std::string& file_name,
|
||||||
const std::vector<TextureSearchPath>& search_path) const
|
const std::vector<TextureSearchPath>& search_path) const
|
||||||
@ -1231,6 +1231,24 @@ std::string FileManager::searchMusic(const std::string& file_name) const
|
|||||||
return path;
|
return path;
|
||||||
} // searchMusic
|
} // searchMusic
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Returns the full path of a model file by searching all model search paths.
|
||||||
|
* It throws an exception if the file is not found.
|
||||||
|
* \param file_name File name to search for.
|
||||||
|
*/
|
||||||
|
std::string FileManager::searchModel(const std::string& file_name) const
|
||||||
|
{
|
||||||
|
std::string path;
|
||||||
|
bool success = findFile(path, file_name, m_model_search_path);
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
throw std::runtime_error(
|
||||||
|
"[FileManager::searchModel] Cannot find model file '"
|
||||||
|
+file_name+"'.");
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
} // searchModel
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Returns true if the given name is a directory.
|
/** Returns true if the given name is a directory.
|
||||||
* \param path File name to test.
|
* \param path File name to test.
|
||||||
|
@ -162,6 +162,8 @@ public:
|
|||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
std::string searchMusic(const std::string& file_name) const;
|
std::string searchMusic(const std::string& file_name) const;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
std::string searchModel(const std::string& file_name) const;
|
||||||
std::string searchTexture(const std::string& fname) const;
|
std::string searchTexture(const std::string& fname) const;
|
||||||
std::string getUserConfigFile(const std::string& fname) const;
|
std::string getUserConfigFile(const std::string& fname) const;
|
||||||
bool fileExists(const std::string& path) const;
|
bool fileExists(const std::string& path) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user