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
|
||||
// so just misuse the getModelFile function
|
||||
const std::string full_path = file_manager->getAsset(FileManager::MODEL,
|
||||
filename);
|
||||
SFXBuffer* buffer = SFXManager::get()->loadSingleSfx(sfx, full_path);
|
||||
// so just misuse the searchModel function
|
||||
std::string path = file_manager->searchModel(filename);
|
||||
path = StringUtils::getPath(path);
|
||||
SFXBuffer* buffer = SFXManager::get()->loadSingleSfx(sfx, path);
|
||||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
|
@ -601,14 +601,14 @@ bool FileManager::findFile(std::string& full_path,
|
||||
return false;
|
||||
} // findFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** 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
|
||||
* "" if the file is not found.
|
||||
* \param file_name The name of the file to look for.
|
||||
* \param search_path The list of paths to search for the file.
|
||||
* \return True if the file is found, false otherwise.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/** 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
|
||||
* "" if the file is not found.
|
||||
* \param file_name The name of the file to look for.
|
||||
* \param search_path The list of paths to search for the file.
|
||||
* \return True if the file is found, false otherwise.
|
||||
*/
|
||||
bool FileManager::findFile(std::string& full_path,
|
||||
const std::string& file_name,
|
||||
const std::vector<TextureSearchPath>& search_path) const
|
||||
@ -1231,6 +1231,24 @@ std::string FileManager::searchMusic(const std::string& file_name) const
|
||||
return path;
|
||||
} // 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.
|
||||
* \param path File name to test.
|
||||
|
@ -162,6 +162,8 @@ public:
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
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 getUserConfigFile(const std::string& fname) const;
|
||||
bool fileExists(const std::string& path) const;
|
||||
|
Loading…
Reference in New Issue
Block a user