From c4dde2f738a555cdac899cab66b0546acc539b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 14 Jun 2006 12:31:46 +0000 Subject: [PATCH] * No need to create a BPath object for the leaf name in CreateAppMetaMimeThread. * The preferred application is now written with the case preserved. This fixes bug #635. * Minor cleanup. * BApplication::_InitData() now also corrects a pre-registered application signature if the case is different. Note, however, that the application watching mechanism doesn't seem to work correctly with this, maybe sending out those should be postponed until the registration is completed? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17836 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Application.cpp | 4 +-- .../storage/mime/CreateAppMetaMimeThread.cpp | 31 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 438580fae0..19a47a8532 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -330,8 +330,8 @@ BApplication::_InitData(const char *signature, bool initGUI, status_t *_error) fMsgPort = appInfo.port; } else appInfo.port = fMsgPort; - // check the signature and correct it, if necessary - if (strcasecmp(appInfo.signature, fAppName)) + // check the signature and correct it, if necessary, also the case + if (strcmp(appInfo.signature, fAppName)) BRoster::Private().SetSignature(team, fAppName); // complete the registration fInitError = BRoster::Private().CompleteRegistration(team, thread, diff --git a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp b/src/kits/storage/mime/CreateAppMetaMimeThread.cpp index 79696e9976..949dc79018 100644 --- a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp +++ b/src/kits/storage/mime/CreateAppMetaMimeThread.cpp @@ -54,11 +54,6 @@ CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, bool* _entryIsDir) if (status < B_OK) return status; - BPath path; - status = path.SetTo(ref); - if (status < B_OK) - return status; - // Read the app sig (which consequently keeps us from updating // non-applications, since we get an error if the file has no // app sig) @@ -77,29 +72,29 @@ CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, bool* _entryIsDir) if (!mime.IsInstalled()) mime.Install(); - signature.ToLower(); - // Signatures and MIME types are case insensitive + BString path = "/"; + path.Append(signature); + path.ToLower(); + // Signatures and MIME types are case insensitive, but we want to + // preserve the case wherever possible + path.Prepend(kDatabaseDir.c_str()); - char metaMimePath[B_PATH_NAME_LENGTH]; - sprintf(metaMimePath, "%s/%s", kDatabaseDir.c_str(), signature.String()); - - status = typeNode.SetTo(metaMimePath); + status = typeNode.SetTo(path.String()); if (status < B_OK) return status; // Preferred App attr_info info; - if (status == B_OK && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) != B_OK)) { + if (status == B_OK && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) != B_OK)) status = mime.SetPreferredApp(signature.String()); - } + // Short Description (name of the application) - if (status == B_OK && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) != B_OK)) { - status = mime.SetShortDescription(path.Leaf()); - } + if (status == B_OK && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) != B_OK)) + status = mime.SetShortDescription(ref->name); + // App Hint - if (status == B_OK && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) != B_OK)) { + if (status == B_OK && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) != B_OK)) status = mime.SetAppHint(ref); - } // Mini Icon BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);