Panda3D
 All Classes Functions Variables Enumerations
apply_patch.cxx
1 // Filename: apply_patch.cxx
2 // Created by:
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pandabase.h"
16 #include "pystub.h"
17 #include "panda_getopt.h"
18 #include "preprocess_argv.h"
19 #include "patchfile.h"
20 #include "filename.h"
21 
22 int
23 main(int argc, char **argv) {
24  // A call to pystub() to force libpystub.so to be linked in.
25  pystub();
26 
27  preprocess_argv(argc, argv);
28 
29  if (argc < 3) {
30  cerr << "Usage: apply_patch <patch_file> <old_file>" << endl;
31  cerr << "Will overwrite old_file" << endl;
32  return 1;
33  }
34 
35  Filename patch = argv[1];
36  patch.set_binary();
37 
38  Filename file = argv[2];
39  file.set_binary();
40 
41  Patchfile pfile;
42 
43  cerr << "Applying patch file " << patch << " to " << file << endl;
44  if (pfile.apply(patch, file) == false) {
45  cerr << "apply patch failed" << endl;
46  return 1;
47  }
48 
49  return 0;
50 }
void set_binary()
Indicates that the filename represents a binary file.
Definition: filename.I:494
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44