BAppFileInfo::SetTo() no longer fails in case the resources couldn't be initialized.
This allows it to read the attributes (if any) from scripts as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17473 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -122,31 +122,46 @@ BAppFileInfo::SetTo(BFile *file)
|
|||||||
delete fResources;
|
delete fResources;
|
||||||
fResources = NULL;
|
fResources = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check param
|
// check param
|
||||||
status_t error = (file && file->InitCheck() == B_OK ? B_OK : B_BAD_VALUE);
|
status_t error = (file && file->InitCheck() == B_OK ? B_OK : B_BAD_VALUE);
|
||||||
|
|
||||||
|
info_location where = B_USE_BOTH_LOCATIONS;
|
||||||
|
|
||||||
// create resources
|
// create resources
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
fResources = new(nothrow) BResources();
|
fResources = new(nothrow) BResources();
|
||||||
if (fResources)
|
if (fResources) {
|
||||||
error = fResources->SetTo(file);
|
error = fResources->SetTo(file);
|
||||||
else
|
if (error != B_OK) {
|
||||||
|
// no resources - this is no critical error, we'll just use
|
||||||
|
// attributes only, then
|
||||||
|
where = B_USE_ATTRIBUTES;
|
||||||
|
error = B_OK;
|
||||||
|
}
|
||||||
|
} else
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set node info
|
// set node info
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = BNodeInfo::SetTo(file);
|
error = BNodeInfo::SetTo(file);
|
||||||
|
|
||||||
|
if (error != B_OK || (where & B_USE_RESOURCES) == 0) {
|
||||||
|
delete fResources;
|
||||||
|
fResources = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// clean up on error
|
// clean up on error
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
if (fResources) {
|
|
||||||
delete fResources;
|
|
||||||
fResources = NULL;
|
|
||||||
}
|
|
||||||
if (InitCheck() == B_OK)
|
if (InitCheck() == B_OK)
|
||||||
BNodeInfo::SetTo(NULL);
|
BNodeInfo::SetTo(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set data location
|
// set data location
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
SetInfoLocation(B_USE_BOTH_LOCATIONS);
|
SetInfoLocation(where);
|
||||||
|
|
||||||
// set error
|
// set error
|
||||||
fCStatus = error;
|
fCStatus = error;
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
Reference in New Issue
Block a user