Framework for context independent sounffont management

Not tested yet!
This commit is contained in:
Christoph Oelckers 2018-02-22 12:51:45 +01:00
commit a6fa906764
9 changed files with 612 additions and 52 deletions

View file

@ -222,7 +222,7 @@ std::pair<FileReader *, std::string> PathList::openFile(const char *name, bool i
{
/* First try the given name */
if (!isAbsPath(name))
if (!IsAbsPath(name))
{
for (int i = (int)paths.size() - 1; i >= 0; i--)
{
@ -253,18 +253,6 @@ std::pair<FileReader *, std::string> PathList::openFile(const char *name, bool i
return std::make_pair(nullptr, std::string());
}
int PathList::isAbsPath(const char *name)
{
if (name[0] == '/') return 1;
#ifdef _WIN32
/* [A-Za-z]: (for Windows) */
if (isalpha(name[0]) && name[1] == ':') return 1;
#endif /* _WIN32 */
return 0;
}
struct timidity_file *open_file(const char *name, bool ismainfile, PathList &pathList)
{
auto file = pathList.openFile(name, ismainfile);
@ -320,4 +308,4 @@ long tf_tell(struct timidity_file *tf)
return tf->url->Tell();
}
}
}