Creating the contents of the file in line

For our tiny data1 file, we could just as easily have included it in line — that is to say, we could have specified its contents directly in the buildfile itself, without the need to have a real data1 file reside somewhere on the host's filesystem. To include the contents in line, we would have specified:

data1 = {
This is a data file, called data1, contained in the image.
Note that this is a convenient way of associating data
files with your programs.
}

A few notes. If your inline file contains the closing brace ("}"), then you must escape that closing brace with a backslash ("\"). This also means that all backslashes must be escaped as well. To have an inline file that contains the following:

This includes a {, a }, and a \ character.

you would have to specify this file (let's call it data2) as follows:

data2 = {
This includes a {, a \}, and a \\ character.
}

Note that since we didn't want the data2 file to contain leading spaces, we didn't supply any in the inline definition. The following, while perhaps "better looking," would be incorrect:

# This is wrong, because it includes leading spaces!
data2 = {
    This includes a {, a \}, and a \\ character.
}

If the filename that you're specifying has "weird" characters in it, then you must quote the name with double quote characters ("). For example, to create a file called I "think" so (note the spaces and quotation marks), you would have to specify it as follows:

"I \"think\" so" = ...

But naming files like this is discouraged, since the filenames are somewhat awkward to type from a command line (not to mention that they look goofy).