Panda3D
testCopy.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file testCopy.cxx
10  * @author drose
11  * @date 2000-10-31
12  */
13 
14 #include "testCopy.h"
15 #include "cvsSourceDirectory.h"
16 
17 /**
18  *
19  */
20 TestCopy::
21 TestCopy() {
22  set_program_brief("copy files into a CVS source hierarchy");
23  set_program_description
24  ("This program copies one or more files into a CVS source hierarchy. "
25  "Rather than copying the named files immediately into the current "
26  "directory, it first scans the entire source hierarchy, identifying all "
27  "the already-existing files. If the named file to copy matches the "
28  "name of an already-existing file in the current directory or elsewhere "
29  "in the hierarchy, that file is overwritten.\n\n"
30 
31  "This is primarily useful as a test program for libcvscopy.");
32 }
33 
34 /**
35  *
36  */
37 void TestCopy::
38 run() {
39  SourceFiles::iterator fi;
40  for (fi = _source_files.begin(); fi != _source_files.end(); ++fi) {
41  CVSSourceDirectory *dest = import(*fi, 0, _model_dir);
42  if (dest == nullptr) {
43  exit(1);
44  }
45  }
46 }
47 
48 /**
49  * Called by import() if the timestamps indicate that a file needs to be
50  * copied. This does the actual copy of a file from source to destination.
51  * If new_file is true, then dest does not already exist.
52  */
53 bool TestCopy::
54 copy_file(const Filename &source, const Filename &dest,
55  CVSSourceDirectory *, void *, bool) {
56  return copy_binary_file(source, dest);
57 }
58 
59 
60 int main(int argc, char *argv[]) {
61  TestCopy prog;
62  prog.parse_command_line(argc, argv);
63  prog.run();
64  return 0;
65 }
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
This represents one particular directory in the hierarchy of source directory files.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
A program to copy ordinary files into the cvs tree.
Definition: testCopy.h:25
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.