39#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
49int test_fcopy::execute()
68 log(
astring(
"Scanning source tree at \"") + source_dir +
"\"");
72 "the source directory could not be read");
75 log(
astring(
"Scanning target tree at \"") + target_dir +
"\"");
79 "the target directory could not be read");
81 LOG(
"calculating checksums for source.");
82 if (!source.calculate(
true))
84 "the source tree could not be calculated");
86 LOG(
"calculating checksums for target.");
87 if (!target.calculate(
true))
89 "the target tree could not be calculated");
98 LOG(
"comparing the two trees.");
106 diffs.
pack(packed_form);
108 if (!regen.
unpack(packed_form))
110 "could not unpack the list of differences");
117 "there were a different number of elements in unpacked form");
118 for (
int i = 0; i < diffs.
elements(); i++) {
119 if (!regen.
member(*diffs[i])) {
122 astring(
"name from original set was missing in regenerated: ")
127 for (
int i = 0; i < diffs.
elements(); i++) {
140 astring(
"failed to create the target directory ") + targ_dir);
147 +
" when copying the file.");
The application_shell is a base object for console programs.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
application_shell()
constructs an application_shell to serve as the root of the program.
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
static astring get(const astring &variable_name)
looks up the "variable_name" in the current environment variables.
Outcomes describe the state of completion for an operation.
An object that traverses directory trees and provides a view of all files.
static bool compare_trees(const directory_tree &source, const directory_tree &target, filename_list &differences, file_info::file_similarity how_to_compare)
compares the tree in "source" with the tree in "target".
static bool recursive_create(const basis::astring &directory_name)
returns true if the "directory_name" can be created or already exists.
Encapsulates some measures and calculations based on a file's contents.
const basis::astring & secondary() const
observes the alternate form of the name.
@ EQUAL_CHECKSUM_TIMESTAMP_FILESIZE
bool member(const filename &to_check) const
finds the index for "to_find" or returns a negative number.
virtual void pack(basis::byte_array &packed_form) const
Creates a packed form of the packable object in "packed_form".
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
Provides operations commonly needed on file names.
static basis::astring default_separator()
returns the default separator character for this OS.
bool is_directory() const
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
filename dirname() const
returns the directory for the filename.
static basis::outcome copy_file(const basis::astring &source, const basis::astring &destination, int copy_chunk_factor=heavy_file_operations::copy_chunk_factor())
copies a file from the "source" location to the "destination".
static const char * outcome_name(const basis::outcome &to_name)
static void alert_message(const char *info, const char *title="Alert Message")
shows the message in "info", with an optional "title" on the message.
int elements() const
the maximum number of elements currently allowed in this amorph.
#define non_continuable_error(c, f, i)
an extra piece of information used, if available, in bounds_halt below.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
Useful support functions for unit testing, especially within hoople.