Cleanup animation
This commit is contained in:
@@ -14,12 +14,12 @@ errorret_t assetInitLinux(void) {
|
||||
// Engine may have been provided the launch path
|
||||
if(ENGINE.argc > 0) {
|
||||
// Get the directory of the executable
|
||||
char_t buffer[ASSET_FILE_PATH_MAX];
|
||||
stringCopy(buffer, ENGINE.argv[0], ASSET_FILE_PATH_MAX);
|
||||
char_t buffer[ASSET_SYSTEM_PATH_MAX];
|
||||
stringCopy(buffer, ENGINE.argv[0], ASSET_SYSTEM_PATH_MAX);
|
||||
size_t len = strlen(buffer);
|
||||
|
||||
// Normalize slashes
|
||||
for(size_t i = 0; i < ASSET_FILE_PATH_MAX; i++) {
|
||||
for(size_t i = 0; i < ASSET_SYSTEM_PATH_MAX; i++) {
|
||||
if(buffer[i] == '\0') break;
|
||||
if(buffer[i] == '\\') buffer[i] = '/';
|
||||
}
|
||||
@@ -38,36 +38,36 @@ errorret_t assetInitLinux(void) {
|
||||
// Did we find a slash?
|
||||
if(end != buffer) {
|
||||
// We found the directory, set as system path
|
||||
stringCopy(ASSET.platform.systemPath, buffer, ASSET_FILE_PATH_MAX);
|
||||
stringCopy(ASSET.platform.systemPath, buffer, ASSET_SYSTEM_PATH_MAX);
|
||||
}
|
||||
} else {
|
||||
// Default system path, intended to be overridden by the platform
|
||||
stringCopy(ASSET.platform.systemPath, ".", ASSET_FILE_PATH_MAX);
|
||||
stringCopy(ASSET.platform.systemPath, ".", ASSET_SYSTEM_PATH_MAX);
|
||||
}
|
||||
|
||||
// Open zip file
|
||||
char_t searchPath[ASSET_FILE_PATH_MAX];
|
||||
char_t searchPath[ASSET_SYSTEM_PATH_MAX];
|
||||
const char_t **path = ASSET_LINUX_SEARCH_PATHS;
|
||||
int32_t error;
|
||||
do {
|
||||
char_t temp[ASSET_FILE_PATH_MAX];
|
||||
char_t temp[ASSET_SYSTEM_PATH_MAX];
|
||||
snprintf(
|
||||
temp,
|
||||
ASSET_FILE_PATH_MAX,
|
||||
ASSET_SYSTEM_PATH_MAX,
|
||||
*path,
|
||||
ASSET_FILE_NAME
|
||||
);
|
||||
|
||||
// Ensure combined length does not exceed ASSET_FILE_PATH_MAX
|
||||
// Ensure combined length does not exceed ASSET_SYSTEM_PATH_MAX
|
||||
size_t syslen = strlen(ASSET.platform.systemPath);
|
||||
size_t slashlen = 1; // for '/'
|
||||
size_t max_temp = ASSET_FILE_PATH_MAX - syslen - slashlen - 1;
|
||||
size_t max_temp = ASSET_SYSTEM_PATH_MAX - syslen - slashlen - 1;
|
||||
if(strlen(temp) > max_temp) {
|
||||
temp[max_temp] = '\0';
|
||||
}
|
||||
snprintf(
|
||||
searchPath,
|
||||
ASSET_FILE_PATH_MAX,
|
||||
ASSET_SYSTEM_PATH_MAX,
|
||||
"%s/%s",
|
||||
ASSET.platform.systemPath,
|
||||
temp
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "error/error.h"
|
||||
#include "asset/assetfile.h"
|
||||
|
||||
#define ASSET_SYSTEM_PATH_MAX FILENAME_MAX
|
||||
|
||||
static const char_t *ASSET_LINUX_SEARCH_PATHS[] = {
|
||||
"%s",
|
||||
"../%s",
|
||||
@@ -19,7 +21,7 @@ static const char_t *ASSET_LINUX_SEARCH_PATHS[] = {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char_t systemPath[ASSET_FILE_PATH_MAX];
|
||||
char_t systemPath[ASSET_SYSTEM_PATH_MAX];
|
||||
} assetlinux_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user