[epiphany/wip/hadess/app-mode-fixes] web-app-utils: Add more debug for application-mode failures




commit b15dc9f5d09a71465a4ac4990e3960c3cc466afd
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 13 16:59:18 2021 +0100

    web-app-utils: Add more debug for application-mode failures
    
    Add some debug to help with debugging --application-mode failures.

 lib/ephy-web-app-utils.c | 9 +++++++--
 src/ephy-main.c          | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index e696be0b8..0f48d711f 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -465,9 +465,12 @@ ephy_web_application_ensure_for_app_info (GAppInfo *app_info)
 
   /* Create the profile directory, populate it. */
   if (g_mkdir (profile_dir, 488) == -1) {
-    if (errno == EEXIST)
+    int err = errno;
+    if (err == EEXIST)
       return g_steal_pointer (&profile_dir);
 
+    g_debug ("Failed to create directory '%s' for app id '%s': %s (%d)",
+             profile_dir, id, g_strerror (err), err);
     return NULL;
   }
 
@@ -478,7 +481,9 @@ ephy_web_application_ensure_for_app_info (GAppInfo *app_info)
   app_file = g_build_filename (profile_dir, ".app", NULL);
   fd = g_open (app_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
   if (fd < 0) {
-    g_warning ("Failed to create .app file: %s", g_strerror (errno));
+    int err = errno;
+    g_warning ("Failed to create .app file in '%s': %s (%d)",
+               profile_dir, g_strerror (err), err);
     return NULL;
   }
   close (fd);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 48b6c684b..c6225e963 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -296,6 +296,8 @@ main (int   argc,
 
       if (desktop_info)
         profile_directory = ephy_web_application_ensure_for_app_info (G_APP_INFO (desktop_info));
+      else
+        g_debug ("Could not instantiate GDesktopAppInfo for '%s'", desktop_file_basename);
 
       if (!profile_directory) {
         g_print ("Invalid desktop file passed to --application-mode\n");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]