[haiku-commits] Change in haiku[master]: libtracker: don't try to fix permissions on read-only volumes

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 30 Jun 2022 15:43:59 +0000

From Jérôme Duval <jerome.duval@xxxxxxxxx>:

Jérôme Duval has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/5425 ;)


Change subject: libtracker: don't try to fix permissions on read-only volumes
......................................................................

libtracker: don't try to fix permissions on read-only volumes

* instead try to guess the type, find the app, and launch the app with the 
document refs.
* fix #5783
---
M src/kits/tracker/FSUtils.cpp
1 file changed, 19 insertions(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/25/5425/1

diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp
index 27b5689..5ab5262 100644
--- a/src/kits/tracker/FSUtils.cpp
+++ b/src/kits/tracker/FSUtils.cpp
@@ -2463,7 +2463,7 @@
                if (status != B_OK)
                        return status;

-               (*_runningSize) += statbuf.st_blocks* 512;
+               (*_runningSize) += statbuf.st_blocks * 512;

                if (S_ISDIR(statbuf.st_mode)) {
                        BDirectory subdir(&entry);
@@ -3583,6 +3583,24 @@
                                error = B_OK;
                        if (error == B_OK || mimesetIt != 0)
                                break;
+                       if (error == B_LAUNCH_FAILED_EXECUTABLE) {
+                               BVolume volume(documentRef.device);
+                               if (volume.IsReadOnly()) {
+                                       BMimeType type;
+                                       error = 
BMimeType::GuessMimeType(&documentRef, &type);
+                                       if (error != B_OK)
+                                               break;
+                                       error = be_roster->FindApp(type.Type(), 
&app);
+                                       if (error != B_OK)
+                                               break;
+                                       error = be_roster->Launch(&app, refs, 
&team);
+                                       if (error == B_ALREADY_RUNNING)
+                                               // app already running, not 
really an error
+                                               error = B_OK;
+                                       if (error == B_OK || mimesetIt != 0)
+                                               break;
+                               }
+                       }

                        SniffIfGeneric(&copyOfRefs);
                }

--
To view, visit https://review.haiku-os.org/c/haiku/+/5425
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Icd25a81ff28038fec0494045390edc6271433b07
Gerrit-Change-Number: 5425
Gerrit-PatchSet: 1
Gerrit-Owner: Jérôme Duval <jerome.duval@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: libtracker: don't try to fix permissions on read-only volumes - Gerrit