* 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
This commit is contained in:
Axel Dörfler
2006-06-14 12:31:46 +00:00
parent 89b35356db
commit c4dde2f738
2 changed files with 15 additions and 20 deletions
+2 -2
View File
@@ -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,
@@ -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);