Sfoglia il codice sorgente

FileManager: Open ".wav" files in SoundPlayer when activated

Now you can double-click on WAV files in the FileManager. Neato! :^)
Andreas Kling 5 anni fa
parent
commit
5cfd67ecbb
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      Applications/FileManager/DirectoryView.cpp

+ 10 - 0
Applications/FileManager/DirectoryView.cpp

@@ -35,6 +35,16 @@ void DirectoryView::handle_activation(const GModelIndex& index)
         return;
     }
 
+    if (path.to_lowercase().ends_with(".wav")) {
+        if (fork() == 0) {
+            int rc = execl("/bin/SoundPlayer", "/bin/SoundPlayer", path.characters(), nullptr);
+            if (rc < 0)
+                perror("exec");
+            ASSERT_NOT_REACHED();
+        }
+        return;
+    }
+
     if (fork() == 0) {
         int rc = execl("/bin/TextEditor", "/bin/TextEditor", path.characters(), nullptr);
         if (rc < 0)