[DEV] update to Web build mode
This commit is contained in:
parent
8b16d5b1e0
commit
5bba60d195
@ -65,10 +65,10 @@ etk::Archive* etk::Archive::load(const std::string& _fileName) {
|
|||||||
etk::Archive* output=nullptr;
|
etk::Archive* output=nullptr;
|
||||||
std::string tmpName = etk::tolower(_fileName);
|
std::string tmpName = etk::tolower(_fileName);
|
||||||
// select the corect Loader :
|
// select the corect Loader :
|
||||||
if( true == end_with(tmpName, ".zip")
|
if( end_with(tmpName, ".zip") == true
|
||||||
|| true == end_with(tmpName, ".apk") ) {
|
|| end_with(tmpName, ".apk") == true ) {
|
||||||
output = new etk::archive::Zip(_fileName);
|
output = new etk::archive::Zip(_fileName);
|
||||||
if (nullptr==output) {
|
if (output == nullptr) {
|
||||||
TK_ERROR("An error occured when load archive : " << _fileName);
|
TK_ERROR("An error occured when load archive : " << _fileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,7 +16,7 @@ etk::archive::Zip::Zip(const std::string& _fileName, uint64_t _offset) :
|
|||||||
/* Open the zip file */
|
/* Open the zip file */
|
||||||
m_ctx = unzOpenOffset(m_fileName.c_str(), _offset);
|
m_ctx = unzOpenOffset(m_fileName.c_str(), _offset);
|
||||||
if(!m_ctx) {
|
if(!m_ctx) {
|
||||||
TK_ERROR("Unable to open the zip file '" << m_fileName << "'");
|
TK_ERROR("Unable to open the zip file '" << m_fileName << "' offset=" << _offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Get info about the zip file */
|
/* Get info about the zip file */
|
||||||
@ -30,13 +30,14 @@ etk::archive::Zip::Zip(const std::string& _fileName, uint64_t _offset) :
|
|||||||
char tmpFileName[FILENAME_MAX];
|
char tmpFileName[FILENAME_MAX];
|
||||||
unz_file_info tmpFileInfo;
|
unz_file_info tmpFileInfo;
|
||||||
/* Get info about current file. */
|
/* Get info about current file. */
|
||||||
if(unzGetCurrentFileInfo(m_ctx, &tmpFileInfo, tmpFileName, FILENAME_MAX, NULL, 0, NULL, 0) != UNZ_OK) {
|
if(unzGetCurrentFileInfo(m_ctx, &tmpFileInfo, tmpFileName, FILENAME_MAX, nullptr, 0, nullptr, 0) != UNZ_OK) {
|
||||||
TK_ERROR("Could not read file info from the zip file '" << m_fileName << "'");
|
TK_ERROR("Could not read file info from the zip file '" << m_fileName << "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(tmpFileName[strlen(tmpFileName) - 1] == '/' ) {
|
if(tmpFileName[strlen(tmpFileName) - 1] == '/' ) {
|
||||||
// find directory ...
|
// find directory ...
|
||||||
} else {
|
} else {
|
||||||
|
TK_INFO("find file : " << tmpFileName);
|
||||||
m_content.insert(std::pair<std::string, etk::ArchiveContent>(tmpFileName, etk::ArchiveContent(tmpFileInfo.uncompressed_size)));
|
m_content.insert(std::pair<std::string, etk::ArchiveContent>(tmpFileName, etk::ArchiveContent(tmpFileInfo.uncompressed_size)));
|
||||||
}
|
}
|
||||||
/* Go the the next entry listed in the zip file. */
|
/* Go the the next entry listed in the zip file. */
|
||||||
|
@ -324,6 +324,14 @@ std::string etk::FSNodeGetApplicationName() {
|
|||||||
TK_INFO("Loading Intarnal data '" << _apkPath << "'");
|
TK_INFO("Loading Intarnal data '" << _apkPath << "'");
|
||||||
//s_APKArchive = etk::Archive::loadPackage(_apkPath);
|
//s_APKArchive = etk::Archive::loadPackage(_apkPath);
|
||||||
s_APKArchive = etk::Archive::load(_apkPath);
|
s_APKArchive = etk::Archive::load(_apkPath);
|
||||||
|
/*
|
||||||
|
FILE* tmp = fopen(_apkPath.c_str(), "r");
|
||||||
|
if (tmp == nullptr) {
|
||||||
|
TK_ERROR("File does not exist ...");
|
||||||
|
} else {
|
||||||
|
TK_ERROR("File open OK ...");
|
||||||
|
}
|
||||||
|
*/
|
||||||
TK_ASSERT(s_APKArchive != nullptr, "Error loading PKG ... '" << _apkPath << "'");
|
TK_ASSERT(s_APKArchive != nullptr, "Error loading PKG ... '" << _apkPath << "'");
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -389,7 +397,9 @@ void etk::setArgZero(const std::string& _val) {
|
|||||||
l_argZero = _val;
|
l_argZero = _val;
|
||||||
// set defaiult application name ...
|
// set defaiult application name ...
|
||||||
std::vector<std::string> elems = etk::split(_val, '/');
|
std::vector<std::string> elems = etk::split(_val, '/');
|
||||||
|
TK_WARNING("ppppppp" << elems);
|
||||||
etk::initDefaultFolder(elems[elems.size()-1].c_str());
|
etk::initDefaultFolder(elems[elems.size()-1].c_str());
|
||||||
|
TK_WARNING("ppppppp 222");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
On Unixes with /proc really straight and realiable way is to:
|
On Unixes with /proc really straight and realiable way is to:
|
||||||
@ -513,7 +523,12 @@ void etk::initDefaultFolder(const char* _applName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TK_DBG_MODE("Find Basic running PATH : '" << baseRunPath << "'");
|
TK_DBG_MODE("Find Basic running PATH : '" << baseRunPath << "'");
|
||||||
#ifndef __TARGET_OS__Android
|
#if defined(__TARGET_OS__Web)
|
||||||
|
loadAPK("data.zip");
|
||||||
|
baseFolderData = "zz_generic_zz";
|
||||||
|
#endif
|
||||||
|
#if !defined(__TARGET_OS__Android) \
|
||||||
|
&& !defined(__TARGET_OS__Web)
|
||||||
std::string binaryPath = getApplicationPath();
|
std::string binaryPath = getApplicationPath();
|
||||||
binaryPath = etk::replace(binaryPath, '\\', '/');
|
binaryPath = etk::replace(binaryPath, '\\', '/');
|
||||||
size_t pos = binaryPath.rfind('/');
|
size_t pos = binaryPath.rfind('/');
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
#define HAVE_ZIP_DATA
|
#define HAVE_ZIP_DATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __TARGET_OS__Web
|
||||||
|
#define HAVE_ZIP_DATA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ZIP_DATA
|
#ifdef HAVE_ZIP_DATA
|
||||||
namespace etk {
|
namespace etk {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user