static int allua_Path_make_canonical(lua_State * L) { ALLUA_path path = allua_check_path(L, 1); lua_pushboolean(L, al_make_path_canonical(path)); return 1; }
static ALLEGRO_PATH *follow_symlinks(ALLEGRO_PATH *path) { for (;;) { const char *path_str = al_path_cstr(path, '/'); char buf[PATH_MAX]; int len; len = readlink(path_str, buf, sizeof(buf) - 1); if (len <= 0) break; buf[len] = '\0'; al_destroy_path(path); path = al_create_path(buf); } /* Make absolute path. */ { const char *cwd = al_get_current_directory(); ALLEGRO_PATH *cwd_path = al_create_path_for_directory(cwd); if (al_rebase_path(cwd_path, path)) al_make_path_canonical(path); al_destroy_path(cwd_path); al_free((void *) cwd); } return path; }