소스 검색

Rename .bundleignore to .dataignore

Daniele Bartolini 9 년 전
부모
커밋
f8837bdf57
3개의 변경된 파일49개의 추가작업 그리고 33개의 파일을 삭제
  1. 28 12
      docs/basics.rst
  2. 3 3
      src/config.h
  3. 18 18
      src/resource/data_compiler.cpp

+ 28 - 12
docs/basics.rst

@@ -6,9 +6,13 @@ The source directory
 
 
 The source directory contains all the files that make up an application.
 The source directory contains all the files that make up an application.
 
 
-There is no fixed structure for the files and folders in the source directory, you can organize your content as you see fit. You can for example decide to put all the textures and sounds in the "textures" and "sounds" folders respectively, or maybe sort the content on a per-object basis by putting all the assets for an enemy in the "units/enemy" folder.
+There is no fixed structure for the files and folders in the source directory, you can organize
+your content as you see fit. You can for example decide to put all the textures and sounds in the
+"textures" and "sounds" folders, or maybe sort the content on a per-object basis by putting all the
+assets for an enemy in the "units/enemy" folder.
 
 
-There is, however, a small number of required files which are needed for the engine to start-up correctly:
+There is, however, a small number of required files which are needed for the engine to start-up
+correctly:
 
 
 .. code::
 .. code::
 
 
@@ -21,16 +25,25 @@ There is, however, a small number of required files which are needed for the eng
 The boot directory and the boot.config file
 The boot directory and the boot.config file
 -------------------------------------------
 -------------------------------------------
 
 
-Any directory within `the source directory`_ containing the file named ``boot.config`` is a boot directory.
+Any directory within `the source directory`_ containing the file named ``boot.config`` is a boot
+directory.
 
 
-The ``boot.config`` is the first file loaded by Pepper; it specifies the package to load and the lua script to execute on boot and various other boot-time settings. See `boot.config file reference`_ for more details.
+The ``boot.config`` is the first file read by Pepper; it specifies the package to load and the lua
+script to execute on boot and various other boot-time settings.
+See `boot.config file reference`_ for more details.
 
 
-There can be an arbitrary number of boot directories. You can set which boot directory Pepper should use with the switch ``--boot-dir``.
+Normally there is a single ``boot.config`` file, placed at the top of the source directory. This is
+the file which Pepper looks at by default.
 
 
-In the example below, the engine is told to load the package ``boot`` and run the Lua script ``lua/game``.
+In some circumstances is desirable to have multiple ``boot.config`` files.
+You can set which boot directory Pepper should use with the switch ``--boot-dir``.
+
+In the example below, a minimal ``boot.config`` file tells the engine to load the package ``boot``
+and run the Lua script ``lua/game``.
 
 
 .. code::
 .. code::
 
 
+	$ cat boot.config
 	boot_package = "boot"      // Package to load on boot
 	boot_package = "boot"      // Package to load on boot
 	boot_script  = "lua/game"  // Lua script to execute on boot
 	boot_script  = "lua/game"  // Lua script to execute on boot
 
 
@@ -38,8 +51,8 @@ In the example below, the engine is told to load the package ``boot`` and run th
 The data directory
 The data directory
 --------------------
 --------------------
 
 
-Pepper reads source data from `the source directory`_ and compiles it into efficient binary representation.
-The result of the compilation process is stored in the data directory.
+Pepper reads source data from `the source directory`_ and compiles it into efficient binary
+representation. The result of the compilation process is stored in the data directory.
 
 
 .. code::
 .. code::
 
 
@@ -51,19 +64,22 @@ The result of the compilation process is stored in the data directory.
 	├── temp                <- Temporary files from data compilers
 	├── temp                <- Temporary files from data compilers
 	└── last.log            <- Text log from the last engine execution
 	└── last.log            <- Text log from the last engine execution
 
 
-The .bundleignore file
+The .dataignore file
 ----------------------
 ----------------------
 
 
-Many programs store metadata files alongside edited files. This is often the case with text editors and version control systems.
+The ``.dataignore`` file specifies files that Pepper should ignore when compiling data.
 
 
-When Pepper bumps into unknown files in the source directory, it quits the compilation and reports an error.
+When Pepper bumps into unknown files in the source directory, it reports and error and quits the
+compilation.
+This is often desired behavior, since you do not want non-essential data in your source directory.
 
 
-The ``.bundleignore`` file specifies files that Pepper should ignore when compiling data.
+In all other cases, you should create a ``.dataignore`` in the source directory.
 
 
 Example:
 Example:
 
 
 .. code::
 .. code::
 
 
+	$ cat .dataignore
 	# This is a comment.
 	# This is a comment.
 
 
 	# Blank lines are ignored.
 	# Blank lines are ignored.

+ 3 - 3
src/config.h

@@ -95,9 +95,9 @@
 	#define CROWN_TEMP_DIRECTORY "temp"
 	#define CROWN_TEMP_DIRECTORY "temp"
 #endif // CROWN_TEMP_DIRECTORY
 #endif // CROWN_TEMP_DIRECTORY
 
 
-#ifndef CROWN_BUNDLEIGNORE
-	#define CROWN_BUNDLEIGNORE ".bundleignore"
-#endif // CROWN_BUNDLEIGNORE
+#ifndef CROWN_DATAIGNORE
+	#define CROWN_DATAIGNORE ".dataignore"
+#endif // CROWN_DATAIGNORE
 
 
 #ifndef CROWN_LAST_LOG
 #ifndef CROWN_LAST_LOG
 	#define CROWN_LAST_LOG "last.log"
 	#define CROWN_LAST_LOG "last.log"

+ 18 - 18
src/resource/data_compiler.cpp

@@ -349,22 +349,6 @@ void DataCompiler::add_ignore_glob(const char* glob)
 
 
 void DataCompiler::scan()
 void DataCompiler::scan()
 {
 {
-	// Add ignore globs
-	add_ignore_glob("*.tmp");
-	add_ignore_glob("*.wav");
-	add_ignore_glob("*.ogg");
-	add_ignore_glob("*.png");
-	add_ignore_glob("*.tga");
-	add_ignore_glob("*.dds");
-	add_ignore_glob("*.ktx");
-	add_ignore_glob("*.pvr");
-	add_ignore_glob("*.swn"); // VIM swap file.
-	add_ignore_glob("*.swo"); // VIM swap file.
-	add_ignore_glob("*.swp"); // VIM swap file.
-	add_ignore_glob("*.bak");
-	add_ignore_glob("*~");
-	add_ignore_glob(".*");
-
 	// Scan all source directories
 	// Scan all source directories
 	auto cur = map::begin(_source_dirs);
 	auto cur = map::begin(_source_dirs);
 	auto end = map::end(_source_dirs);
 	auto end = map::end(_source_dirs);
@@ -377,9 +361,9 @@ void DataCompiler::scan()
 		prefix += cur->pair.first.c_str();
 		prefix += cur->pair.first.c_str();
 		_source_fs.set_prefix(prefix.c_str());
 		_source_fs.set_prefix(prefix.c_str());
 
 
-		if (_source_fs.exists(CROWN_BUNDLEIGNORE))
+		if (_source_fs.exists(CROWN_DATAIGNORE))
 		{
 		{
-			File& file = *_source_fs.open(CROWN_BUNDLEIGNORE, FileOpenMode::READ);
+			File& file = *_source_fs.open(CROWN_DATAIGNORE, FileOpenMode::READ);
 			const u32 size = file.size();
 			const u32 size = file.size();
 			char* data = (char*)default_allocator().allocate(size + 1);
 			char* data = (char*)default_allocator().allocate(size + 1);
 			file.read(data, size);
 			file.read(data, size);
@@ -581,6 +565,22 @@ int main_data_compiler(int argc, char** argv)
 	dc->register_compiler(RESOURCE_TYPE_TEXTURE,          RESOURCE_VERSION_TEXTURE,          txr::compile);
 	dc->register_compiler(RESOURCE_TYPE_TEXTURE,          RESOURCE_VERSION_TEXTURE,          txr::compile);
 	dc->register_compiler(RESOURCE_TYPE_UNIT,             RESOURCE_VERSION_UNIT,             utr::compile);
 	dc->register_compiler(RESOURCE_TYPE_UNIT,             RESOURCE_VERSION_UNIT,             utr::compile);
 
 
+	// Add ignore globs
+	dc->add_ignore_glob("*.tmp");
+	dc->add_ignore_glob("*.wav");
+	dc->add_ignore_glob("*.ogg");
+	dc->add_ignore_glob("*.png");
+	dc->add_ignore_glob("*.tga");
+	dc->add_ignore_glob("*.dds");
+	dc->add_ignore_glob("*.ktx");
+	dc->add_ignore_glob("*.pvr");
+	dc->add_ignore_glob("*.swn"); // VIM swap file.
+	dc->add_ignore_glob("*.swo"); // VIM swap file.
+	dc->add_ignore_glob("*.swp"); // VIM swap file.
+	dc->add_ignore_glob("*.bak");
+	dc->add_ignore_glob("*~");
+	dc->add_ignore_glob(".*");
+
 	dc->map_source_dir("", opts._source_dir.c_str());
 	dc->map_source_dir("", opts._source_dir.c_str());
 
 
 	if (opts._map_source_dir_name)
 	if (opts._map_source_dir_name)