|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #include <windows.h>
- #include <tchar.h>
-
- #include <iostream>
- #include <string>
-
- #include "Utility.h"
-
- int
- main(int argc, char **argv) {
-
- std::string TempPath = "C:\\TEMP";
- std::string InputDistPath;
- bool Verbose = false;
- bool Interactive = false;
-
- for (int i = 1; i < argc; i++) {
-
- std::string CmdArg;
-
- CmdArg = argv[i];
- if ("-d" == CmdArg) {
-
- if (++i == argc) {
- OutputUsage(TempPath);
- return(-1);
- }
- InputDistPath = argv[i];
-
- } else if ("-t" == CmdArg) {
-
- if (++i == argc) {
- OutputUsage(TempPath);
- return(-1);
- }
- TempPath = argv[i];
-
- } else if ("-v" == CmdArg) {
-
- Verbose = true;
-
- } else if ("-i" == CmdArg) {
-
- Interactive = true;
- Verbose = true;
-
- } else if ("-h" == CmdArg) {
-
- OutputHelp();
- OutputUsage(TempPath);
- return(0);
-
- }
-
- }
-
- if ( ("" == InputDistPath) || ("" == TempPath) ) {
-
- OutputUsage(TempPath);
- return(-1);
-
- }
-
- std::string DistPath;
- std::string DistParentPath;
- std::string DistName;
- std::string TempDir;
-
- try {
-
- GetDirectoryNames(InputDistPath,
- DistPath,
- DistParentPath,
- DistName);
-
- TempDir = TempPath + "\\";
- TempDir += DistName;
-
- if (Verbose) {
-
- std::cout
- << "\nThe distribution will be built from the files in the source "
- "directory "
- << DistPath << ".\n\n"
- << "The files in the directories that exist in both "
- << DistParentPath << " and the source directory will be copied into the "
- << "distribution.\n\n"
- << "The temporary directory is " << TempDir << ".\n\n";
-
- if (Interactive) {
-
- std::cout << "Enter <cr> to continue: ";
-
- (void) std::cin.get();
-
- }
-
- }
-
- StringContainer ExcludeName;
- ExcludeName.push_back(".svn");
- ExcludeName.push_back(".");
- ExcludeName.push_back("..");
- ExcludeName.push_back(DistName);
-
- UpdateCommonDirectories(DistPath, DistParentPath, ExcludeName);
-
-
-
- PrepareTempDir(TempDir);
-
-
- CopyDirectory(DistPath, TempDir, ExcludeName);
-
- if (Verbose) {
-
- std::cout << "Distribution created in " << TempDir << ".\n";
-
- }
-
- } catch (std::exception &e) {
-
- OutputErrorMessage(e.what());
- return(-1);
-
- }
-
- return(0);
- }
|