Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port g_resources::getRealDir from edubart/otclient #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/framework/core/resourcemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,3 +1146,13 @@ void ResourceManager::unmountMemoryData()
m_loadedFromMemory = false;
m_loadedFromArchive = false;
}


std::string ResourceManager::getRealDir(const std::string& path)
{
std::string dir;
const char *cdir = PHYSFS_getRealDir(resolvePath(path).c_str());
if(cdir)
dir = cdir;
return dir;
}
1 change: 1 addition & 0 deletions src/framework/core/resourcemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ResourceManager
std::list<std::string> listDirectoryFiles(const std::string & directoryPath = "", bool fullPath = false, bool raw = false);

std::string resolvePath(std::string path);
std::string getRealDir(const std::string& path);
std::string getWorkDir() { return "/"; }
#ifdef ANDROID
std::string getWriteDir() { return "/"; }
Expand Down
1 change: 1 addition & 0 deletions src/framework/luafunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_resources", "decompressArchive", &ResourceManager::decompressArchive, &g_resources);
g_lua.bindSingletonFunction("g_resources", "setLayout", &ResourceManager::setLayout, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getLayout", &ResourceManager::getLayout, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getRealDir", &ResourceManager::getRealDir, &g_resources);

// Config
g_lua.registerClass<Config>();
Expand Down
Loading