]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
Don't change user-defined desktop files for Waydroid when they're set as read-only
authorLoïc CORBASSON <loic.devel@corbasson.fr>
Wed, 1 Nov 2023 12:43:18 +0000 (13:43 +0100)
committerAlessandro Astone <ales.astone@gmail.com>
Sat, 24 Feb 2024 23:46:59 +0000 (00:46 +0100)
tools/services/user_manager.py

index 92ee203b688eac7f5dc20b6a1aac5fc5e01f642f..83a50cca58cb863d33c30d3a490a859527a0acfe 100644 (file)
@@ -49,10 +49,14 @@ Icon={waydroid_data}/icons/com.android.settings.png
 
     def makeWaydroidDesktopFile(hide):
         desktop_file_path = apps_dir + "/Waydroid.desktop"
-        if os.path.isfile(desktop_file_path):
-            os.remove(desktop_file_path)
-        with open(desktop_file_path, "w") as desktop_file:
-            desktop_file.write(f"""\
+        # If the user has set the desktop file as read-only, we won't replace it
+        if not os.access(desktop_file_path, os.W_OK):
+            logging.info(f"Desktop file '{desktop_file_path}' is not writeable, not updating it")
+        else:
+            if os.path.isfile(desktop_file_path):
+                os.remove(desktop_file_path)
+            with open(desktop_file_path, "w") as desktop_file:
+                desktop_file.write(f"""\
 [Desktop Entry]
 Type=Application
 Name=Waydroid