SORTIE Core C++ Documentation
|
These are functions which use platform-specific code. More...
#include <string>
Functions | |
bool | TarballSetup (string sAppPath) |
Verifies that gzip and tar are where we expect them to be (in the same directory as the executable). More... | |
void | ZipFile (string sFileName, string sAppPath) |
Zips a file with GZIP. More... | |
void | AddFileToTarball (string sTarball, string sFileToAdd, string sAppPath) |
Adds a file to the end of a tarball. More... | |
void | AddFileToNewTarball (string sTarball, string sFileToAdd, string sAppPath) |
Creates a new tarball and adds a file to it. More... | |
void | DeleteThisFile (string sFile) |
Deletes a file. More... | |
bool | DoesFileExist (string sFile) |
Checks for the existence of a file. More... | |
void | LaunchProcess (string sFile, string sArgs, string sDir) |
Launches a process and waits for it to finish. More... | |
void | ReplaceAll (std::string &source, const std::string &find, const std::string &replace) |
Finds all occurrences of one string within another and replaces them. More... | |
These are functions which use platform-specific code.
Copyright 2003 Charles D. Canham.
Edit history:
--------------—
April 28, 2004 - Submitted as beta (LEM)
June 20, 2007 - New Linux versions of the functions, based on code originally written by Daniel Lipsitt, to whom great thanks is owed (LEM)
void AddFileToNewTarball | ( | string | sTarball, |
string | sFileToAdd, | ||
string | sAppPath | ||
) |
Creates a new tarball and adds a file to it.
Any existing tarball of that name will be overwritten. If the tarball does not exist, it will be created. The file to add can be either zipped or not zipped.
sTarball | File name of tarball |
sFileToAdd | File name of the file to add to the tarball |
sAppPath | Path to the main application, ending with the path separator. The TAR executable is expected to be in the same path. For Linux, tar is expected to be somewhere in the user's PATH. |
void AddFileToTarball | ( | string | sTarball, |
string | sFileToAdd, | ||
string | sAppPath | ||
) |
Adds a file to the end of a tarball.
If the tarball does not exist, it will be created. The file to add can be either zipped or not zipped.
sTarball | File name of tarball |
sFileToAdd | File name of the file to add to the tarball |
sAppPath | Path to the main application, ending with the path separator. The TAR executable is expected to be in the same path. For Linux, tar is expected to be somewhere in the user's PATH. |
void DeleteThisFile | ( | string | sFile | ) |
Deletes a file.
sFile | File name of the file to delete |
bool DoesFileExist | ( | string | sFile | ) |
Checks for the existence of a file.
sFile | File name of the file to check for existence |
void LaunchProcess | ( | string | sFile, |
string | sArgs, | ||
string | sDir | ||
) |
Launches a process and waits for it to finish.
sFile | Executable to launch |
sArgs | Arguments to pass to process |
sDir | Working directory |
void ReplaceAll | ( | std::string & | source, |
const std::string & | find, | ||
const std::string & | replace | ||
) |
Finds all occurrences of one string within another and replaces them.
source | String to search and replace within |
find | String to find |
replace | String to replace with |
bool TarballSetup | ( | string | sAppPath | ) |
Verifies that gzip and tar are where we expect them to be (in the same directory as the executable).
This should be called before either of the functions below and a fatal error thrown if it returns false. For Linux, this function always returns true.
sAppPath | Path to the main application, ending with the path separator. The executables are expected to be in the same path. |
void ZipFile | ( | string | sFileName, |
string | sAppPath | ||
) |
Zips a file with GZIP.
If the file does not exist, the function does nothing.
sFileName | File to zip. |
sAppPath | Path to the main application, ending with the path separator. For Windows, the GZIP executable is expected to be in the same path. For Linux, gzip is expected to be somewhere in the user's PATH. |