diff options
-rw-r--r-- | crawl-ref/INSTALL | 47 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 16 |
2 files changed, 57 insertions, 6 deletions
diff --git a/crawl-ref/INSTALL b/crawl-ref/INSTALL index 5a266f271a..06f643221a 100644 --- a/crawl-ref/INSTALL +++ b/crawl-ref/INSTALL @@ -1,6 +1,6 @@ Install instructions for Dungeon Crawl Stone Soup (DCSS) -------------------------------------------------------- -(Last updated on 20071030 for Dungeon Crawl Stone Soup 0.3.) +(Last updated on 20071202 for Dungeon Crawl Stone Soup 0.3.3.) Building Dungeon Crawl Stone Soup --------------------------------- @@ -71,7 +71,9 @@ MAKEFILE=makefile.mgw to build with MinGW for Windows (# is used for comments in makefiles). Consult the operating-system specific sections for detailed -information on building Crawl. +information on building Crawl. When you're done building Crawl, look +at the section "Data files" for important information on what files +Crawl needs as it starts up. Building on Unix (Linux, *BSD, Solaris, etc.) @@ -209,7 +211,7 @@ binary will run on 9x), or build a DOS binary. * cd to the the Crawl source directory. * Build Crawl by running - mingw32-make MAKEFILE=makefile.mgw + mingw32-make MAKEFILE=makefile.mgw install * If you want regular expression support, you can edit AppHdr.h and uncomment this line: @@ -218,12 +220,12 @@ binary will run on 9x), or build a DOS binary. - find the one in the Windows-specific section. Also see the section below on obtaining the pcre library to link against. -* If you have flex and bison, edit makefile.mgw and set DOYACC := y. - * If you enabled REGEX_PCRE, add -lpcre to the LIB line in makefile.mgw as: LIB = -lpcre -static -lwinmm -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) and build Crawl to include regex support. +* If you have flex and bison, edit makefile.mgw and set DOYACC := y. + * When you're done, you should have crawl.exe under a "rel" subdirectory. @@ -274,6 +276,41 @@ Building for DOS (djgpp) * When the build is done, crawl.exe should be in the source directory. ***************************************************************************** +Data files +---------- + +Crawl looks for several data files when starting up. They include: + +* Special level and vault layout (dat/*.des) files. +* Core Lua code (dat/clua/*.lua). +* Descriptions for monsters and game features (dat/descript/*.txt). +* Monster dialogue files (dat/*.txt). + +All these files are in the source tree under source/dat. + +Crawl will also look for documentation files when players invoke the +help system. These files are available under the docs directory. + +Your built Crawl binary must be able to find these files, or it will +not start. + +If Crawl is built without an explicit DATA_DIR_PATH (this is the most +common setup), it will search for its data files under the current +directory, and if it can't find them there, one level above the +current directory. In short, it uses these search paths: ., ./dat, +./docs, .., ../dat, ../docs. + +If Crawl is built with an explicit DATA_DIR_PATH (for multiuser +installs on Unix), it will look for its startup files strictly under +that directory: $DIR, $DIR/dat, $DIR/docs. + +As Crawl loads its startup files, it will convert them to a binary +format (so that future startups will be faster) and store these binary +files in the saves directory. These binary files (with extensions .db, +.dsc, .idx, .lk) can be safely deleted as long as there is no running +Crawl, and they will be regenerated the next time Crawl starts. + +***************************************************************************** The level compiler ------------------ diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index bf82b47e10..2f845fff44 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -47,7 +47,6 @@ #ifdef __MINGW32__ #include <io.h> -#include <sys/types.h> #endif #include <sys/types.h> @@ -93,6 +92,12 @@ #include "view.h" #include "xom.h" +#ifndef HAVE_STAT +#if defined(UNIX) || defined(__MINGW32__) || defined(DOS) +#define HAVE_STAT +#endif +#endif + void save_level(int level_saved, level_area_type lt, branch_type where_were_you); @@ -288,11 +293,17 @@ void check_newer(const std::string &target, static bool file_exists(const std::string &name) { +#ifdef HAVE_STAT + struct stat st; + const int err = ::stat(name.c_str(), &st); + return (!err); +#else FILE *f = fopen(name.c_str(), "r"); const bool exists = !!f; if (f) fclose(f); return (exists); +#endif } // Low-tech existence check. @@ -369,8 +380,11 @@ std::string datafile_path(std::string basename, const std::string prefixes[] = { std::string("dat") + FILE_SEPARATOR, std::string("docs") + FILE_SEPARATOR, +#ifndef DATA_DIR_PATH std::string("..") + FILE_SEPARATOR + "docs" + FILE_SEPARATOR, + std::string("..") + FILE_SEPARATOR + "dat" + FILE_SEPARATOR, std::string("..") + FILE_SEPARATOR, +#endif std::string(".") + FILE_SEPARATOR, "", }; |