//
// Utility.h
//
// Header file for utility functions for BuildDistribution.
//
// (C) Copyright 2010 ARM Research Labs, LLC See
// www.armresearch.com for the copyright terms.
//
// $Id$
//

#include <string>
#include <vector>

/// Output the usage message.
//
// \param[in] DefaultTempPath is the default directory to build the
// distribution.
//
void OutputUsage(std::string DefaultTempPath);

/// Output the help message.
void OutputHelp(void);

/// Output a formatted message describing the last error from WINAPI.
//
// \param[in] Message is the message to output.  The system error message
// is output after Message.
//
void OutputErrorMessage(std::string Message);

/// This function returns the various paths and names for building the
/// distribution.
//
// \param[in] InputDistPath is the source path specified on the command line.
//
// \param[out] DistSourcePath is the source path determined from
// InputDistPath.
//
// \param[out] DistParentPath is the parent directory of the source
// directory.
//
// \param[out] DistName is the name of the distribution (without any ".zip"
// appended.
//
void GetDirectoryNames(std::string &InputDistPath,
		       std::string &DistSourcePath,
		       std::string &DistParentPath,
		       std::string &DistName);

typedef std::vector<std::string> StringContainer;                               ///< Container to hold a set of strings.

/// Update the files in the distribution.
//
// \param[in] DistPath is the name of the directory that contains the
// distribution.
//
// \param[in] DistParentPath is the name of the parent directory of DistDir.
//
// \param[in] ExcludeName contains the names of the files to not
// update.
//
//  This function updates the directories in the distribution:
//
//  1) For each directory DIR that appears in DistDir and also
//     in DistParentDir:
//
//     a) Delete the contents of DistDir/DIR, except for ExcludeName.
//
//     b) Copy the contents of DistParentDir\DIR to DistDir\DIR, except
//        for ExcludeName.
//
void UpdateCommonDirectories(std::string DistPath,
			     std::string DistParentPath,
			     StringContainer ExcludeName);

/// Prepare the temporary directory for the distribution.
//
// This function creates a temporary directory for the distribution if
// it doesn't exist.  If the temporary directory does exist, the
// contents are removed.
//
// \param[in] TempPath is the path to the directory that is to contain
// the distribution that will be zipped.
//
void PrepareTempDir(std::string TempPath);

/// Copy a directory tree, except for specified files.
//
// \param[in] SourcePath is the directory to copy from.
//
// \param[in] DestPath is the directory to copy to.  This directory
// must exist.
//
// \param[in] ExcludeName contains the names of file to not copy.
//
void CopyDirectory(std::string SourcePath, std::string DestPath, StringContainer ExcludeName);
