Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: [Freeciv] Re: Rulesets, Tilesets, and Winblows
Home

[Freeciv-Dev] Re: [Freeciv] Re: Rulesets, Tilesets, and Winblows

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Todd Goodman <tgoodman@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Freeciv] Re: Rulesets, Tilesets, and Winblows
From: akemnade@xxxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 2 Sep 2002 12:06:51 +0200

On Sun, 1 Sep 2002 16:45:38 -0400
Todd Goodman <tgoodman@xxxxxxxxxxxxx> wrote:

> Thank you very much Andreas for this information.  I tried looking into
> this but couldn't figure out why a file was needed in the freeciv share
> directory.
> 
> Regards,
> 
> Todd
The following code shows the problem:
main(int argc, char **argv)
{
   if (fopen(argv[1],"r")==NULL)
     printf("Cannot open %s\n",argv[1]);
   
   return 0;
}

On windows, you cannot open directories in that way but on linux you can.
datafilename(), which should only be used to check if files exists, is used to 
check if directories exists.
On widnows it searches in all the data directories and then it finds the extra  
file. The server thinks that the ruleset exists. Then it checks for files in 
the ruleset directory you have chosen and again it searches in all data 
directories and will find it in the ruleset directory.

The questions are: Are there other places in the code where freeciv checks for 
directories in that wrong way? Do we need to check if directories exist or can 
we check for files instead?
If we need to check for directories, we should consider to use stat().
Is stat() portable enough?

Greetings
Andreas Kemnade


[Prev in Thread] Current Thread [Next in Thread]