23 cerr <<
"Usage: build_patch [opts] <old_file> <new_file>" << endl;
30 "This program generates a patch file that describes the differences\n" 31 "between any two source files. The patch file can later be used to\n" 32 "construct <new_file>, given <old_file>. Arbitrary file types, including\n" 33 "binary files, are supported.\n\n" 35 "The patching algorithm can get very slow for very large files. As an\n" 36 "optimization, if the input files are both Panda Multifiles, the patcher\n" 37 "will by default patch them on a per-subfile basis, which has the potential\n" 38 "to be much faster. The -c option will forbid this and force the patcher\n" 39 "to work on the full file.\n\n" 44 " Specify the filename of the patch file to generate.\n\n" 47 " Always generate patches against the complete file, even if the\n" 48 " input files appear to be multifiles.\n\n" 50 " -f footprint_length\n" 51 " Specify the footprint length for the patching algorithm.\n\n";
55 main(
int argc,
char **argv) {
57 bool complete_file =
false;
58 int footprint_length = 0;
62 static const char *optflags =
"o:cf:h";
64 int flag = getopt(argc, argv, optflags);
77 footprint_length = atoi(optarg);
87 cerr <<
"Unhandled switch: " << flag << endl;
90 flag = getopt(argc, argv, optflags);
106 if (patch_file.empty()) {
111 pfile.set_allow_multifile(!complete_file);
112 if (footprint_length != 0) {
113 cerr <<
"Footprint length is " << footprint_length <<
"\n";
114 pfile.set_footprint_length(footprint_length);
117 cerr <<
"Building patch file to convert " << src_file <<
" to " 118 << dest_file << endl;
119 if (pfile.build(src_file, dest_file, patch_file) ==
false) {
120 cerr <<
"build patch failed" << endl;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_binary()
Indicates that the filename represents a binary file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
std::string get_fullpath() const
Returns the entire filename: directory, basename, extension.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void preprocess_argv(int &argc, char **&argv)
Processes the argc, argv pair as needed before passing it to getopt().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static Filename from_os_specific(const std::string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes,...