15 #include "pandabase.h" 17 #include "panda_getopt.h" 18 #include "preprocess_argv.h" 19 #include "patchfile.h" 24 cerr <<
"Usage: build_patch [opts] <old_file> <new_file>" << endl;
31 "This program generates a patch file that describes the differences\n" 32 "between any two source files. The patch file can later be used to\n" 33 "construct <new_file>, given <old_file>. Arbitrary file types, including\n" 34 "binary files, are supported.\n\n" 36 "The patching algorithm can get very slow for very large files. As an\n" 37 "optimization, if the input files are both Panda Multifiles, the patcher\n" 38 "will by default patch them on a per-subfile basis, which has the potential\n" 39 "to be much faster. The -c option will forbid this and force the patcher\n" 40 "to work on the full file.\n\n" 45 " Specify the filename of the patch file to generate.\n\n" 48 " Always generate patches against the complete file, even if the\n" 49 " input files appear to be multifiles.\n\n" 51 " -f footprint_length\n" 52 " Specify the footprint length for the patching algorithm.\n\n";
56 main(
int argc,
char **argv) {
61 bool complete_file =
false;
62 int footprint_length = 0;
66 static const char *optflags =
"o:cf:h";
67 preprocess_argv(argc, argv);
68 int flag = getopt(argc, argv, optflags);
81 footprint_length = atoi(optarg);
91 cerr <<
"Unhandled switch: " << flag << endl;
94 flag = getopt(argc, argv, optflags);
110 if (patch_file.empty()) {
115 pfile.set_allow_multifile(!complete_file);
116 if (footprint_length != 0) {
117 cerr <<
"Footprint length is " << footprint_length <<
"\n";
118 pfile.set_footprint_length(footprint_length);
121 cerr <<
"Building patch file to convert " << src_file <<
" to " 122 << dest_file << endl;
123 if (pfile.build(src_file, dest_file, patch_file) ==
false) {
124 cerr <<
"build patch failed" << endl;
string get_fullpath() const
Returns the entire filename: directory, basename, extension.
void set_binary()
Indicates that the filename represents a binary file.
The name of a file, such as a texture file or an Egg file.
static Filename from_os_specific(const string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes, and no drive letter) based on the supplied filename string that describes a filename in the local system conventions (for instance, on Windows, it may use backslashes or begin with a drive letter and a colon).