Merged revisions 520:521 from branches/Exiv2-0_6_041212, updated test results

This commit is contained in:
Andreas Huggel 2005-03-12 12:43:04 +00:00
parent cac5030c7b
commit a8f6bc2f84
4 changed files with 30 additions and 14 deletions

View File

@ -878,7 +878,9 @@ namespace Action {
rc = writeThumbnail();
}
if (Params::instance().target_ & ~Params::ctThumb) {
std::string exvPath = Util::dirname(path_) + SEPERATOR_STR
std::string directory = Params::instance().directory_;
if (directory.empty()) directory = Util::dirname(path_);
std::string exvPath = directory + SEPERATOR_STR
+ Util::basename(path_, true) + ".exv";
if (!Params::instance().force_ && Util::fileExists(exvPath)) {
std::cout << Params::instance().progname()
@ -923,7 +925,9 @@ namespace Action {
return -3;
}
std::string thumb = Util::dirname(path_) + SEPERATOR_STR
std::string directory = Params::instance().directory_;
if (directory.empty()) directory = Util::dirname(path_);
std::string thumb = directory + SEPERATOR_STR
+ Util::basename(path_, true) + "-thumb";
std::string thumbExt = exifData.thumbnailExtension();
if (thumbExt.empty()) {
@ -977,7 +981,9 @@ namespace Action {
&& Params::instance().target_ & Params::ctExif
|| Params::instance().target_ & Params::ctIptc
|| Params::instance().target_ & Params::ctComment) {
std::string exvPath = Util::dirname(path) + SEPERATOR_STR
std::string directory = Params::instance().directory_;
if (directory.empty()) directory = Util::dirname(path);
std::string exvPath = directory + SEPERATOR_STR
+ Util::basename(path, true) + ".exv";
rc = metacopy(exvPath, path, true);
}
@ -992,7 +998,9 @@ namespace Action {
int Insert::insertThumbnail(const std::string& path) const
{
std::string thumbPath = Util::dirname(path) + SEPERATOR_STR
std::string directory = Params::instance().directory_;
if (directory.empty()) directory = Util::dirname(path);
std::string thumbPath = directory + SEPERATOR_STR
+ Util::basename(path, true) + "-thumb.jpg";
if (!Util::fileExists(thumbPath, true)) {
std::cerr << thumbPath

View File

@ -53,7 +53,7 @@ EXIV2_RCSID("@(#) $Id$");
// local declarations
namespace {
//! List of all command itentifiers and corresponding strings
//! List of all command identifiers and corresponding strings
static const CmdIdAndString cmdIdAndString[] = {
add, "add",
set, "set",
@ -179,8 +179,8 @@ void Params::help(std::ostream& os) const
os << "\nActions:\n"
<< " ad | adjust Adjust Exif timestamps by the given time. This\n"
<< " action requires the option -a time.\n"
<< " pr | print Print Exif or Iptc image metadata.\n"
<< " rm | delete Delete the Exif section or thumbnail from the files.\n"
<< " pr | print Print image metadata.\n"
<< " rm | delete Delete image metadata from the files.\n"
<< " in | insert Insert metadata from corresponding *.exv files.\n"
<< " ex | extract Extract metadata to *.exv and thumbnail image files.\n"
<< " mv | rename Rename files according to the Exif create timestamp.\n"
@ -217,8 +217,9 @@ void Params::help(std::ostream& os) const
<< format_ << ".\n"
<< " -m file Command file for the modify action. The format for commands is\n"
<< " set|add|del <key> [[<type>] <value>].\n"
<< " -M cmd One command line for the modify action. The format for the\n"
<< " commands is the same as that of the lines of a command file.\n\n";
<< " -M cmd Command line for the modify action. The format for the\n"
<< " commands is the same as that of the lines of a command file.\n"
<< " -l dir Location (directory) for files to be inserted or extracted.\n\n";
} // Params::help
int Params::option(int opt, const std::string& optarg, int optopt)
@ -237,6 +238,7 @@ int Params::option(int opt, const std::string& optarg, int optopt)
case 'i': rc = evalInsert(optarg); break;
case 'm': rc = evalModify(opt, optarg); break;
case 'M': rc = evalModify(opt, optarg); break;
case 'l': directory_ = optarg; break;
case ':':
std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
<< " requires an argument\n";
@ -558,6 +560,10 @@ int Params::getopt(int argc, char* const argv[])
rc = 1;
}
}
if (!directory_.empty() && !(action_ == Action::insert || action_ == Action::extract)) {
std::cerr << progname() << ": -l option can only be used with extract or insert actions\n";
rc = 1;
}
return rc;
} // Params::getopt

View File

@ -141,6 +141,7 @@ public:
CmdFiles cmdFiles_; //!< Names of the modification command files
CmdLines cmdLines_; //!< Commands from the command line
ModifyCmds modifyCmds_; //!< Parsed modification commands
std::string directory_; //!< Location for files to extract/insert
Files files_; //!< List of non-option arguments.
private:
@ -148,7 +149,7 @@ private:
@brief Default constructor. Note that optstring_ is initialized here.
The c'tor is private to force instantiation through instance().
*/
Params() : optstring_(":hVvfa:r:p:d:e:i:m:M:"),
Params() : optstring_(":hVvfa:r:p:d:e:i:m:M:l:"),
help_(false),
version_(false),
verbose_(false),

View File

@ -9,15 +9,15 @@ This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Exiv2 help ---------------------------------------------------------------
Usage: lt-exiv2 [ options ] [ action ] file ...
Usage: exiv2 [ options ] [ action ] file ...
Manipulate the Exif metadata of images.
Actions:
ad | adjust Adjust Exif timestamps by the given time. This
action requires the option -a time.
pr | print Print Exif or Iptc image metadata.
rm | delete Delete the Exif section or thumbnail from the files.
pr | print Print image metadata.
rm | delete Delete image metadata from the files.
in | insert Insert metadata from corresponding *.exv files.
ex | extract Extract metadata to *.exv and thumbnail image files.
mv | rename Rename files according to the Exif create timestamp.
@ -54,8 +54,9 @@ Options:
follows strftime(3). Default filename format is %Y%m%d_%H%M%S.
-m file Command file for the modify action. The format for commands is
set|add|del <key> [[<type>] <value>].
-M cmd One command line for the modify action. The format for the
-M cmd Command line for the modify action. The format for the
commands is the same as that of the lines of a command file.
-l dir Location (directory) for files to be inserted or extracted.
Adjust -------------------------------------------------------------------