Welcome, Guest. Please login or register.

Author Topic: Dir scanning: Which method is best?  (Read 1834 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ChaosLordTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show all replies
    • http://totalchaoseng.dbv.pl/news.php
Dir scanning: Which method is best?
« on: October 13, 2006, 01:55:43 PM »
Programming Question:
What is the best techinique to traverse a directory?

1. UNIX opendir() readdir()
2. SASC dnext() dfind()
3. AmigaOS Examine() ExNext()
4. AmigaOS ExAll()

Aargh!  Decisions decisions!

I need to traverse some directories at high speed.
At first I was going to use the UNIX way of opendir() readdir() based on
the assumption that every C compiler in the universe has those
functions.  BUT I can't figure out how to tell if it has returned a
FILEname or a DIRname?  My old SASC manual seems to be missing that info.
Or maybe it just isn't possible under unix?

Then I noticed some old code that uses dnext() and dfind().  Very nice
and simple and great!  BUT the manual says these only exist in SASC!
ARGH!  I am trying to write multiplatform-friendly code!

So then I figured I could use AmigaOS routines.  They should be the
fastest and smoothest under AmigaOS but I will have to completely rewrite
them when I port the game to SDL. :(((

AND even if I use AmigaOS way of doing things... which technique should I
use?  Examine() + ExNext() ?    Or ExAll() ?  Auugh!

How do I decide??
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA