Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] [Pactch] stat (was: Re: [Freeciv] Re: Rulesets, Tilesets,
Home

[Freeciv-Dev] [Pactch] stat (was: Re: [Freeciv] Re: Rulesets, Tilesets,

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: akemnade@xxxxxxxxxxxxxxxxxxxxxxxx
Cc: Todd Goodman <tgoodman@xxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [Pactch] stat (was: Re: [Freeciv] Re: Rulesets, Tilesets, and Winblows)
From: Andreas Kemnade <akemnade@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Sep 2002 14:46:45 +0200

akemnade@xxxxxxxxxxxxxxxxxxxxxxxx writes:
 > 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?
Here is a patch which solves the problem

Greetings
Andreas Kemnade

Attachment: stat.diff
Description: Binary data


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