[DEV] add export APi and permit to get current application binary path

This commit is contained in:
Edouard DUPIN 2016-11-23 21:44:17 +01:00
parent e58e03ffb2
commit 249c8a4ea3
3 changed files with 24 additions and 0 deletions

View File

@ -289,6 +289,7 @@ static std::mutex& getNodeMutex() {
// zip file of the apk file for Android ==> set to zip file apk access
static std::string s_fileAPK = "";
static std::string baseApplName = "ewolNoName";
static std::string baseApplPath = "ewolNoName";
static std::string baseRunPath = "/";
static std::string baseRunPathInHome = "/";
#if defined(__TARGET_OS__Android)
@ -312,6 +313,10 @@ std::string etk::FSNodeGetApplicationName() {
return baseApplName;
}
std::string etk::FSNodeGetApplicationPath() {
return baseApplPath;
}
#ifdef HAVE_ZIP_DATA
static etk::Archive* s_APKArchive = nullptr;
static void loadAPK(const std::string& _apkPath) {
@ -538,6 +543,7 @@ void etk::initDefaultFolder(const char* _applName) {
binaryName = std::string(binaryName.begin()+1, binaryName.end());
}
binaryPath.erase(binaryPath.begin() + pos, binaryPath.end());
baseApplPath = binaryPath;
TK_INFO("Bianry name : '" << binaryPath << "' && '" << binaryName << "'" );
#ifdef __TARGET_OS__Windows
// check if we have a data path just near the .exe file

View File

@ -52,6 +52,11 @@ namespace etk {
* @return The application name
*/
std::string FSNodeGetApplicationName();
/**
* @brief Get application binary path.
* @return The application path
*/
std::string FSNodeGetApplicationPath();
/**
* @brief List of Type that a node can have (this wrap some type that not exist on Windows)
*/

View File

@ -54,3 +54,16 @@
#endif
#endif
#ifdef _WIN32
//#define ETK_EXPORT_API extern "C" __declspec( dllimport )
#define ETK_EXPORT_API
#else
#define ETK_EXPORT_API extern "C" __attribute__ ((visibility ("default")))
#endif
#ifdef _WIN32
#define ETK_EXPORT_VISIBILITY
#else
#define ETK_EXPORT_VISIBILITY __attribute__ ((visibility ("default")))
#endif