Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path
Home

[Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 May 2004 16:31:10 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8677 >

The "civ" and "ser" scripts now set FREECIV_PATH.  However if there was 
no path previously set, freeciv would come up with a sensible default, 
including . and ~/.freeciv.  Now ~/.freeciv is ignored when you run the 
civ script, unless you set it explicitly.

It's probably not a good idea to have the civ and ser scripts mess with 
the path.  Instead I think we should actually change the working 
directory to be the SRCDIR, while still running the correct executable 
in the BUILDDIR.

jason

Index: civ.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/civ.in,v
retrieving revision 1.2
diff -u -r1.2 civ.in
--- civ.in      4 May 2004 18:33:00 -0000       1.2
+++ civ.in      4 May 2004 23:30:53 -0000
@@ -14,21 +14,18 @@
 #
 #***********************************************************************/
 
-DIR=`dirname $0`
+# Find absolute paths for srcdir and builddir.
+BUILDDIR=`dirname $0`
+BUILDDIR=`cd $BUILDDIR; pwd`
 
-# Use cd + pwd instead of manual concatentation in case of absolute paths
-if [ "x$FREECIV_PATH" == "x" ] ; then
-  export FREECIV_PATH="$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-else
-  export FREECIV_PATH="$FREECIV_PATH:$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-fi
+SRCDIR=`cd $BUILDDIR ; cd @top_srcdir@ ; pwd`
 
-[ -x $DIR/client/civclient ] && EXE=$DIR/client/civclient
-[ -x $DIR/civclient ] && EXE=$DIR/civclient
+[ -x $BUILDDIR/client/civclient ] && EXE=$BUILDDIR/client/civclient
+[ -x $BUILDDIR/civclient ] && EXE=$BUILDDIR/civclient
 
 if [ "$EXE" = "" ]; then
   echo $0: Unable to find civclient.
   exit 1
 fi
 
-exec $EXE ${1+"$@"}
+cd $SRCDIR && exec $EXE ${1+"$@"}
Index: ser.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ser.in,v
retrieving revision 1.2
diff -u -r1.2 ser.in
--- ser.in      4 May 2004 18:33:00 -0000       1.2
+++ ser.in      4 May 2004 23:30:53 -0000
@@ -14,21 +14,18 @@
 #
 #***********************************************************************/
 
-DIR=`dirname $0`
+# Find absolute paths for srcdir and builddir.
+BUILDDIR=`dirname $0`
+BUILDDIR=`cd $BUILDDIR; pwd`
 
-# Use cd + pwd instead of manual concatentation in case of absolute paths
-if [ "x$FREECIV_PATH" == "x" ] ; then
-  export FREECIV_PATH="$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-else
-  export FREECIV_PATH="$FREECIV_PATH:$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-fi
+SRCDIR=`cd $BUILDDIR ; cd @top_srcdir@ ; pwd`
 
-[ -x $DIR/server/civserver ] && EXE=$DIR/server/civserver
-[ -x $DIR/civserver ] && EXE=$DIR/civserver
+[ -x $BUILDDIR/server/civserver ] && EXE=$BUILDDIR/server/civserver
+[ -x $BUILDDIR/civserver ] && EXE=$BUILDDIR/civserver
 
 if [ "$EXE" = "" ]; then
   echo $0: Unable to find civserver.
   exit 1
 fi
 
-exec $EXE ${1+"$@"}
+cd $SRCDIR && exec $EXE ${1+"$@"}

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path, Jason Short <=