From e27438edbaeff2b18eaedde8a51286ad21dfe65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 27 Feb 2004 21:34:11 +0000 Subject: [PATCH] Will now replace the entry_ref name with the volume title if it's a directory (since only volumes can slip through, not any directory). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6781 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskprobe/FileWindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/apps/diskprobe/FileWindow.cpp b/src/apps/diskprobe/FileWindow.cpp index 52fe53001b..a05bafba3b 100644 --- a/src/apps/diskprobe/FileWindow.cpp +++ b/src/apps/diskprobe/FileWindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -23,9 +24,16 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) BEntry entry(ref); struct stat stat; - if (entry.GetStat(&stat) == B_OK && (stat.st_mode & (S_IFBLK | S_IFCHR)) != 0) { + if (entry.GetStat(&stat) == B_OK && (S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode))) { BPath path(ref); SetTitle(path.Path()); + } else if (entry.IsDirectory()) { + BVolume volume(stat.st_dev); + if (volume.InitCheck() == B_OK) { + char name[B_FILE_NAME_LENGTH]; + if (volume.GetName(name) == B_OK) + SetTitle(name); + } } // add the menu @@ -79,7 +87,7 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) } -bool +bool FileWindow::QuitRequested() { bool quit = fProbeView->QuitRequested();