From aa48c99b9645c49b6aad30e51cfe8b6e864b976a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 7 Oct 2002 22:09:26 +0000 Subject: [PATCH] Remote application supports not having a signature set in resources/attributes and uses a default signature then. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1442 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/app/broster/RosterTestAppDefs.h | 4 ++++ .../app/broster/testapps/RosterLaunchTestApp1.cpp | 15 +++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/tests/kits/app/broster/RosterTestAppDefs.h b/src/tests/kits/app/broster/RosterTestAppDefs.h index 95a3c24c19..afe207a315 100644 --- a/src/tests/kits/app/broster/RosterTestAppDefs.h +++ b/src/tests/kits/app/broster/RosterTestAppDefs.h @@ -16,4 +16,8 @@ enum { MSG_READY_TO_RUN = 'redy', // }; +// Argh, a macro! But that way, we avoid a compiler warning. +#define kDefaultTestAppSignature \ + "application/x-vnd.obos-roster-launch-app-default" + #endif // ROSTER_TEST_APP_DEF_H diff --git a/src/tests/kits/app/broster/testapps/RosterLaunchTestApp1.cpp b/src/tests/kits/app/broster/testapps/RosterLaunchTestApp1.cpp index e521475336..b52ec156b3 100644 --- a/src/tests/kits/app/broster/testapps/RosterLaunchTestApp1.cpp +++ b/src/tests/kits/app/broster/testapps/RosterLaunchTestApp1.cpp @@ -142,15 +142,14 @@ main(int argc, char **argv) error = file.SetTo(path, B_READ_ONLY); // get signature BString signatureString; - if (error == B_OK) - error = file.ReadAttrString("signature", &signatureString); - else + if (error == B_OK) { + if (file.ReadAttrString("signature", &signatureString) == B_OK + && signatureString.Length() > 0) { + strcpy(signature, signatureString.String()); + } else + strcpy(signature, kDefaultTestAppSignature); + } else printf("ERROR: Couldn't init app file: %s\n", strerror(error)); - // copy signature - if (error == B_OK) - strcpy(signature, signatureString.String()); - else - printf("ERROR: Couldn't get signature: %s\n", strerror(error)); } else printf("ERROR: Couldn't get app ref: %s\n", strerror(error)); // create the app