[DEV] add a corect path of the windows folders (not the installed one but a local
This commit is contained in:
parent
6fde63610d
commit
302f121b2d
@ -26,8 +26,8 @@ void GeneralDebugSetLevel(etk::logLevel_te ccc);
|
||||
#define ETK_DBG_COMMON(libName, info, data) do { \
|
||||
if (info <= g_requestedLevel) { \
|
||||
etk::cout << etk::cstart << info; \
|
||||
TOOLS_DisplayTime(); \
|
||||
TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName); \
|
||||
/*TOOLS_DisplayTime();*/ \
|
||||
/*TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName);*/ \
|
||||
etk::cout << data; \
|
||||
etk::cout <<etk::endl; \
|
||||
} \
|
||||
|
@ -44,7 +44,9 @@
|
||||
#else
|
||||
void etk::DisplayBacktrace(void)
|
||||
{
|
||||
|
||||
#if DEBUG_LEVEL > 2
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -267,7 +269,9 @@ etk::CCout& etk::CCout::operator << (CStart ccc)
|
||||
|
||||
etk::CCout& etk::CCout::operator << (etk::CEndl t)
|
||||
{
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
strncat(m_tmpChar, ETK_BASH_COLOR_NORMAL, MAX_LOG_SIZE);
|
||||
#endif
|
||||
strncat(m_tmpChar, "\n", MAX_LOG_SIZE);
|
||||
m_tmpChar[MAX_LOG_SIZE] = '\0';
|
||||
#if defined(__TARGET_OS__Android)
|
||||
|
@ -855,6 +855,15 @@ etk::Vector<etk::UString> etk::UString::Split(const etk::UniChar& _val)
|
||||
}
|
||||
|
||||
|
||||
void etk::UString::Replace(const etk::UniChar& _out, const etk::UniChar& _in)
|
||||
{
|
||||
for(int32_t iii=0 ; iii<m_data.Size() ; iii++) {
|
||||
if (m_data[iii]==_out) {
|
||||
m_data[iii]=_in;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void etk::UString::Lower(void)
|
||||
{
|
||||
for( int32_t iii=0 ; iii<m_data.Size() ; iii++) {
|
||||
|
@ -154,6 +154,12 @@ namespace etk
|
||||
* @return The list of all sthe string splited.
|
||||
*/
|
||||
etk::Vector<etk::UString> Split(const etk::UniChar& _val);
|
||||
/**
|
||||
* @brief Replace a char with an other
|
||||
* @param[in] _out element to replace.
|
||||
* @param[in] _in Element to set.
|
||||
*/
|
||||
void Replace(const etk::UniChar& _out, const etk::UniChar& _in);
|
||||
|
||||
etk::Vector<etk::UniChar> GetVector(void);
|
||||
etk::UniChar* pointer(void) { return &m_data[0]; };
|
||||
|
@ -14,7 +14,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <etk/tool.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
#ifdef __TARGET_OS__Windows
|
||||
#include "windows.h"
|
||||
#endif
|
||||
extern "C" {
|
||||
// file browsing ...
|
||||
#include <dirent.h>
|
||||
@ -265,6 +267,7 @@ etk::UString GetApplicationPath(void)
|
||||
}
|
||||
// and now we will really in a bad mood ...
|
||||
#endif
|
||||
TK_INFO("Binary name : " << binaryName);
|
||||
return binaryName;
|
||||
}
|
||||
|
||||
@ -298,39 +301,51 @@ void etk::InitDefaultFolder(const char * applName)
|
||||
|
||||
#ifndef __TARGET_OS__Android
|
||||
etk::UString binaryPath = GetApplicationPath();
|
||||
binaryPath.Replace('\\', '/');
|
||||
int32_t pos = binaryPath.FindBack('/');
|
||||
etk::UString binaryName = binaryPath.Extract(pos);
|
||||
binaryPath.Remove(pos, binaryName.Size());
|
||||
TK_VERBOSE("Bianry name : '" << binaryPath << "' && '" << binaryName << "'" );
|
||||
// if element is installed :
|
||||
baseFolderData = "/usr/share";
|
||||
baseFolderData += binaryName;
|
||||
baseFolderData += "/";
|
||||
|
||||
etk::UString theoricInstalledName = "/usr/bin";
|
||||
theoricInstalledName += binaryName;
|
||||
TK_VERBOSE(" position : '" << binaryPath << "' installed position : '" << theoricInstalledName << "'");
|
||||
if (binaryPath != theoricInstalledName) {
|
||||
TK_INFO(" base path is not correct try to find it : (must only appear in test and not when installed) base name : '" << binaryPath << "'");
|
||||
// remove bin/applName
|
||||
TK_INFO("Bianry name : '" << binaryPath << "' && '" << binaryName << "'" );
|
||||
#ifdef __TARGET_OS__Windows
|
||||
baseFolderData = binaryPath;
|
||||
#ifdef __TARGET_OS__MacOs
|
||||
baseFolderData += "/../../Resources/";
|
||||
#else
|
||||
baseFolderData += "/../../share";
|
||||
baseFolderData += binaryName;
|
||||
baseFolderData += "/";
|
||||
#endif
|
||||
baseFolderData = SimplifyPathAbstractPath(baseFolderData);
|
||||
}
|
||||
baseFolderDataUser = baseFolderHome;
|
||||
baseFolderDataUser += "/.local/share/";
|
||||
baseFolderDataUser += binaryName;
|
||||
baseFolderDataUser += "/";
|
||||
|
||||
baseFolderCache = "/tmp/";
|
||||
baseFolderCache += binaryName;
|
||||
baseFolderCache += "/";
|
||||
baseFolderData += "/data/";
|
||||
|
||||
baseFolderDataUser = binaryPath;
|
||||
baseFolderDataUser += "/user/";
|
||||
|
||||
baseFolderCache = binaryPath;
|
||||
baseFolderCache += "/tmp/";
|
||||
#else
|
||||
// if element is installed :
|
||||
baseFolderData = "/usr/share";
|
||||
baseFolderData += binaryName;
|
||||
baseFolderData += "/";
|
||||
|
||||
etk::UString theoricInstalledName = "/usr/bin";
|
||||
theoricInstalledName += binaryName;
|
||||
TK_VERBOSE(" position : '" << binaryPath << "' installed position : '" << theoricInstalledName << "'");
|
||||
if (binaryPath != theoricInstalledName) {
|
||||
TK_INFO(" base path is not correct try to find it : (must only appear in test and not when installed) base name : '" << binaryPath << "'");
|
||||
// remove bin/applName
|
||||
baseFolderData = binaryPath;
|
||||
#ifdef __TARGET_OS__MacOs
|
||||
baseFolderData += "/../../Resources/";
|
||||
#else
|
||||
baseFolderData += "/../../share";
|
||||
baseFolderData += binaryName;
|
||||
baseFolderData += "/";
|
||||
#endif
|
||||
baseFolderData = SimplifyPathAbstractPath(baseFolderData);
|
||||
}
|
||||
baseFolderDataUser = baseFolderHome;
|
||||
baseFolderDataUser += "/.local/share/";
|
||||
baseFolderDataUser += binaryName;
|
||||
baseFolderDataUser += "/";
|
||||
|
||||
baseFolderCache = "/tmp/";
|
||||
baseFolderCache += binaryName;
|
||||
baseFolderCache += "/";
|
||||
#endif
|
||||
#endif
|
||||
TK_INFO("baseFolderHome : '" << baseFolderHome << "'");
|
||||
TK_INFO("baseFolderData : '" << baseFolderData << "'");
|
||||
|
@ -51,7 +51,8 @@ def Create(target):
|
||||
myModule.AddExportFlag_CC("-DDEBUG_LEVEL=3")
|
||||
myModule.AddExportFlag_CC("-DDEBUG=1")
|
||||
# Bor backtrace display :
|
||||
myModule.AddExportflag_LD("-ldl -rdynamic")
|
||||
if target.name!="Windows":
|
||||
myModule.AddExportflag_LD("-ldl -rdynamic")
|
||||
|
||||
if target.name=="Windows":
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user