Created
July 23, 2019 13:40
-
-
Save ryonagana/4e24c8a2ee452e5cb76fad03f698b4ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *path_data_folder(const char *folder, const char *file) | |
{ | |
ALLEGRO_PATH *exe_path = NULL; | |
ALLEGRO_PATH *path = NULL; | |
ALLEGRO_PATH *data_dir = NULL; | |
char copy_path[2048]; | |
exe_path = al_get_standard_path(ALLEGRO_RESOURCES_PATH); | |
strncpy(copy_path,"",2048); | |
strncat(copy_path, folder, strlen(folder)); | |
strncat(copy_path,"/", strlen(folder)); | |
strncat(copy_path, file, strlen(file)); | |
path = al_create_path(copy_path); | |
data_dir = al_create_path("data/"); | |
al_join_paths(data_dir,path); | |
al_join_paths(exe_path, data_dir); | |
const char *full_path = al_path_cstr(exe_path, ALLEGRO_NATIVE_PATH_SEP ); | |
size_t size = strlen(full_path) + 1; | |
char *ret = calloc(size, sizeof(char)); //malloc(sizeof(char) * strlen(full_path) + 1); | |
memset(ret,'\0', sizeof(char) * size); | |
strncpy(ret, full_path, strlen(full_path)); | |
al_destroy_path(path); | |
al_destroy_path(data_dir); | |
CB_free((void*) &full_path); | |
return ret; | |
//path = al_create_path( al_join_paths('') ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment