Example #1
0
/* Function: al_make_path_absolute
 */
bool al_make_path_absolute(ALLEGRO_PATH *path)
{
   ALLEGRO_PATH *cwd_path;
   int i;

   ASSERT(path);

   if (path_is_absolute(path)) {
      return true;
   }

   cwd_path = al_get_current_directory();
   if (!cwd_path)
      return false;

   al_set_path_drive(path, al_get_path_drive(cwd_path));

   for (i = al_get_path_num_components(cwd_path) - 1; i >= 0; i--) {
      al_insert_path_component(path, 0, al_get_path_component(cwd_path, i));
   }

   al_destroy_path(cwd_path);

   return true;
}
Example #2
0
File: path.c Project: trezker/allua
static int allua_Path_get_num_components(lua_State * L)
{
   ALLUA_path path = allua_check_path(L, 1);

   lua_pushnumber(L, al_get_path_num_components(path));

   return 1;
}
Example #3
0
/* Function: al_get_path_tail
 */
const char *al_get_path_tail(const ALLEGRO_PATH *path)
{
   ASSERT(path);

   if (al_get_path_num_components(path) == 0)
      return NULL;

   return al_get_path_component(path, -1);
}
Example #4
0
/* Function: al_drop_path_tail
 */
void al_drop_path_tail(ALLEGRO_PATH *path)
{
   if (al_get_path_num_components(path) > 0) {
      al_remove_path_component(path, -1);
   }
}