Panda3D

testCopy.cxx

00001 // Filename: testCopy.cxx
00002 // Created by:  drose (31Oct00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "testCopy.h"
00016 #include "cvsSourceDirectory.h"
00017 #include "pystub.h"
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //     Function: TestCopy::Constructor
00021 //       Access: Public
00022 //  Description:
00023 ////////////////////////////////////////////////////////////////////
00024 TestCopy::
00025 TestCopy() {
00026   set_program_description
00027     ("This program copies one or more files into a CVS source hierarchy.  "
00028      "Rather than copying the named files immediately into the current "
00029      "directory, it first scans the entire source hierarchy, identifying all "
00030      "the already-existing files.  If the named file to copy matches the "
00031      "name of an already-existing file in the current directory or elsewhere "
00032      "in the hierarchy, that file is overwritten.\n\n"
00033 
00034      "This is primarily useful as a test program for libcvscopy.");
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: TestCopy::run
00039 //       Access: Public
00040 //  Description:
00041 ////////////////////////////////////////////////////////////////////
00042 void TestCopy::
00043 run() {
00044   SourceFiles::iterator fi;
00045   for (fi = _source_files.begin(); fi != _source_files.end(); ++fi) {
00046     CVSSourceDirectory *dest = import(*fi, 0, _model_dir);
00047     if (dest == (CVSSourceDirectory *)NULL) {
00048       exit(1);
00049     }
00050   }
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: TestCopy::copy_file
00055 //       Access: Protected, Virtual
00056 //  Description: Called by import() if the timestamps indicate that a
00057 //               file needs to be copied.  This does the actual copy
00058 //               of a file from source to destination.  If new_file is
00059 //               true, then dest does not already exist.
00060 ////////////////////////////////////////////////////////////////////
00061 bool TestCopy::
00062 copy_file(const Filename &source, const Filename &dest,
00063           CVSSourceDirectory *, void *, bool) {
00064   return copy_binary_file(source, dest);
00065 }
00066 
00067 
00068 int main(int argc, char *argv[]) {
00069   // A call to pystub() to force libpystub.so to be linked in.
00070   pystub();
00071 
00072   TestCopy prog;
00073   prog.parse_command_line(argc, argv);
00074   prog.run();
00075   return 0;
00076 }
 All Classes Functions Variables Enumerations