Subversion Repositories checksum-tools

Compare Revisions

Regard whitespace Rev 3 → Rev 4

/trunk/PHP/sfv_generate.php
20,6 → 20,8
// This script generates SFV files
// If there is already an SFV file existing, only new files get appended to the existing SFV files.
 
// TODO: make use of STDERR and return different exit codes
 
function _rec($directory) {
if (!is_dir($directory)) {
die("Invalid directory path $directory\n");
44,7 → 46,8
if (is_dir($fullpath)) {
_rec($fullpath);
} else {
### echo "$fullpath\n";
global $show_verbose;
if ($show_verbose) echo "$fullpath\n";
$dir = pathinfo($fullpath, PATHINFO_DIRNAME);
 
if (!file_exists($sfv_file)) {
88,16 → 91,27
 
# ---
 
if ($argc != 2) {
echo "Syntax: $argv[0] <directory>\n";
$show_verbose = false;
$dir = '';
 
for ($i=1; $i<$argc; $i++) {
if ($argv[$i] == '-v') {
$show_verbose = true;
} else {
$dir = $argv[$i];
}
}
 
if (empty($dir)) {
echo "Syntax: $argv[0] [-v] <directory>\n";
exit(2);
}
 
if (!is_dir($argv[1])) {
if (!is_dir($dir)) {
echo "Directory not found\n";
exit(1);
}
 
_rec($argv[1]);
_rec($dir);
 
echo "Done.\n";
if ($show_verbose) echo "Done.\n";