Only write the icons if we did in fact have to freshly create the Trash directory. Should fix #5827 completely.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36522 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2010-04-28 20:17:30 +00:00
parent 0872569da9
commit ca34b4221c
+11 -3
View File
@@ -2362,7 +2362,13 @@ FSGetTrashDir(BDirectory *trashDir, dev_t dev)
return result; return result;
BPath path; BPath path;
result = find_directory(B_TRASH_DIRECTORY, &path, true, &volume); bool created = false;
result = find_directory(B_TRASH_DIRECTORY, &path, false, &volume);
if (result != B_OK) {
result = find_directory(B_TRASH_DIRECTORY, &path, true,
&volume);
created = true;
}
if (result != B_OK) if (result != B_OK)
return result; return result;
@@ -2370,6 +2376,8 @@ FSGetTrashDir(BDirectory *trashDir, dev_t dev)
if (result != B_OK) if (result != B_OK)
return result; return result;
if (created)
{
// make trash invisible // make trash invisible
StatStruct sbuf; StatStruct sbuf;
trashDir->GetStat(&sbuf); trashDir->GetStat(&sbuf);
@@ -2393,8 +2401,7 @@ FSGetTrashDir(BDirectory *trashDir, dev_t dev)
trashDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, trashDir->WriteAttr(kAttrMiniIcon, 'MICN', 0,
data, size); data, size);
} }
// TODO: figure out why writing the vector icon seems broken. #ifdef __HAIKU__
#if 0
data = GetTrackerResources()-> data = GetTrackerResources()->
LoadResource(B_VECTOR_ICON_TYPE, R_TrashIcon, &size); LoadResource(B_VECTOR_ICON_TYPE, R_TrashIcon, &size);
if (data != NULL) { if (data != NULL) {
@@ -2402,6 +2409,7 @@ FSGetTrashDir(BDirectory *trashDir, dev_t dev)
data, size); data, size);
} }
#endif #endif
}
return B_OK; return B_OK;
} }