packit / rpms / bottles

Forked from rpms/bottles 3 months ago
Clone
Blob Blame History Raw
commit 7eed7bbfa5d1da924b4c4e0659f0bf86b0fd7d7b
Author: Sandro <devel@penguinpee.nl>
Date:   Mon Mar 4 20:28:49 2024 +0100

    Make sure Paths.bottles exists
    
    When calling `bottles foo.exe` either from the command line or by
    opening the executable from the file browser with Bottles, Bottles will
    throw a FileNotFoundError if Paths.bottles does not exist.
    
    It seems check_app_dirs() is never called in that situation.

diff --git a/bottles/backend/managers/manager.py b/bottles/backend/managers/manager.py
index 01b0039e..9d8ef000 100644
--- a/bottles/backend/managers/manager.py
+++ b/bottles/backend/managers/manager.py
@@ -811,7 +811,11 @@ class Manager(metaclass=Singleton):
         Check for local bottles and update the local_bottles list.
         Will also mark the broken ones if the configuration file is missing
         """
-        bottles = os.listdir(Paths.bottles)
+        try:
+            bottles = os.listdir(Paths.bottles)
+        except FileNotFoundError:
+            self.check_app_dirs()
+            bottles = []
 
         # Empty local bottles
         self.local_bottles = {}