PackageInstaller: Added -v/--verbose option
It enables just a few printf()s in PackageItem.cpp. I went with a quick solution using a global variable instead of using/writing some nice logging framework which could even generate install logs... but it helps in tracking down some package problems without first having to uncomment some printf()s...
This commit is contained in:
parent
ecf119cc17
commit
c3a07a5aed
@ -36,6 +36,8 @@ enum {
|
||||
static const uint32 kDefaultMode = 0777;
|
||||
static const uint8 padding[7] = { 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
extern bool gVerbose;
|
||||
|
||||
enum {
|
||||
P_DATA = 0,
|
||||
P_ATTRIBUTE
|
||||
@ -175,17 +177,20 @@ PackageItem::InitPath(const char* path, BPath* destination)
|
||||
status_t ret = B_OK;
|
||||
|
||||
if (fPathType == P_INSTALL_PATH) {
|
||||
// printf("InitPath - relative: %s + %s\n", path, fPath.String());
|
||||
if (gVerbose)
|
||||
printf("InitPath - relative: %s + %s\n", path, fPath.String());
|
||||
if (path == NULL) {
|
||||
parser_debug("InitPath path is NULL\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
ret = destination->SetTo(path, fPath.String());
|
||||
} else if (fPathType == P_SYSTEM_PATH) {
|
||||
// printf("InitPath - absolute: %s\n", fPath.String());
|
||||
if (gVerbose)
|
||||
printf("InitPath - absolute: %s\n", fPath.String());
|
||||
ret = destination->SetTo(fPath.String());
|
||||
} else {
|
||||
// printf("InitPath - volume: %s + %s\n", path, fPath.String());
|
||||
if (gVerbose)
|
||||
printf("InitPath - volume: %s + %s\n", path, fPath.String());
|
||||
if (path == NULL) {
|
||||
parser_debug("InitPath path is NULL\n");
|
||||
return B_ERROR;
|
||||
@ -237,7 +242,8 @@ PackageItem::InitPath(const char* path, BPath* destination)
|
||||
}
|
||||
|
||||
if (wasRewritten) {
|
||||
// printf("rewritten: %s\n", pathString.String());
|
||||
if (gVerbose)
|
||||
printf("rewritten: %s\n", pathString.String());
|
||||
destination->SetTo(pathString.String());
|
||||
}
|
||||
}
|
||||
@ -620,7 +626,8 @@ PackageScript::DoInstall(const char* path, ItemState* state)
|
||||
// that's more fragile... but a common source for
|
||||
// the rewriting of BeOS paths is needed.
|
||||
|
||||
// printf("%s\n", script.String());
|
||||
if (gVerbose)
|
||||
printf("%s\n", script.String());
|
||||
|
||||
BPath workingDirectory;
|
||||
if (path != NULL)
|
||||
|
@ -27,6 +27,9 @@
|
||||
#define B_TRANSLATION_CONTEXT "Packageinstaller main"
|
||||
|
||||
|
||||
bool gVerbose = false;
|
||||
|
||||
|
||||
class PackageInstaller : public BApplication {
|
||||
public:
|
||||
PackageInstaller();
|
||||
@ -84,6 +87,11 @@ void
|
||||
PackageInstaller::ArgvReceived(int32 argc, char** argv)
|
||||
{
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp("--verbose", argv[i]) == 0 || strcmp("-v", argv[i]) == 0) {
|
||||
gVerbose = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
BPath path;
|
||||
if (path.SetTo(argv[i]) != B_OK) {
|
||||
fprintf(stderr, B_TRANSLATE("Error! \"%s\" is not a valid path.\n"),
|
||||
|
Loading…
Reference in New Issue
Block a user