<!DOCTYPE html>
<html lang='en'>
<head>
<title>guix - Wojtek's customized Guix</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/gnu?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='da6486010ab1ac5f6c67764bb599385026b7fe15'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'>k's customized Guix</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=f20d1cfb51ed14f325da000406807076323f70bc'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=f20d1cfb51ed14f325da000406807076323f70bc'>tree</a><a href='/guix/commit/?id=f20d1cfb51ed14f325da000406807076323f70bc'>commit</a><a href='/guix/diff/?id=f20d1cfb51ed14f325da000406807076323f70bc'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='f20d1cfb51ed14f325da000406807076323f70bc'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
@@ -1310,21 +1310,98 @@ FillInLangSubs(Substitution subs, XtPerD
 }
 
 /*
- * default path used if environment variable XFILESEARCHPATH
- * is not defined.  Also substituted for %D.
- * The exact value should be documented in the implementation
- * notes for any Xt implementation.
+   Return the default search path for the function
+   XtResolvePathname to use if XFILESEARCHPATH is
+   not defined.
+
+   It returns the combination the set of values which are the 6 &quot;stems&quot; below,
+   prepended with &quot;/run/current-system/profile&quot;, and $GUIX_PROFILE and
+   &quot;$HOME/.guix-profile&quot;
+
+   These values provide the default paths where Guix/GuixSD can expect
+   to find resources for installed packages.
  */
 static const char *
-implementation_default_path(void)
+guix_default_path(void)
 {
-#if defined(WIN32)
-    static char xfilesearchpath[] = &quot;&quot;;
+  static const char *search_path_default_stem[] = {
+    &quot;/lib/X11/%L/%T/%N%C%S&quot;,
+    &quot;/lib/X11/%l/%T/%N%C%S&quot;,
+    &quot;/lib/X11/%T/%N%C%S&quot;,
+    &quot;/lib/X11/%L/%T/%N%S&quot;,
+    &quot;/lib/X11/%l/%T/%N%S&quot;,
+    &quot;/lib/X11/%T/%N%S&quot;
+  };
+
+#define SIZEOF_STEMS  (strlen (search_path_default_stem[0])	\
+		       + strlen (search_path_default_stem[1])	\
+		       + strlen (search_path_default_stem[2])	\
+		       + strlen (search_path_default_stem[3])	\
+		       + strlen (search_path_default_stem[4])	\
+		       + strlen (search_path_default_stem[5]))
+
+
+  int i;
+  const char *current_profile = &quot;/run/current-system/profile&quot;;
+  char *home = getenv (&quot;HOME&quot;);
+  char *guix_profile = getenv (&quot;GUIX_PROFILE&quot;);
+
+  size_t bytesAllocd = SIZEOF_STEMS + 1;
+
+  /* This function is evaluated multiple times and the calling
+     code assumes that it is idempotent. So we must not allow
+     (say) a changed environment variable to cause it to return
+     something different. */
+  static char *path = NULL;
+  if (path)
+    return path;
+
+  bytesAllocd += 6 * (1 + strlen (current_profile));
+
+  if (guix_profile != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen (guix_profile));
+    }
+  if (home != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen(home) + strlen (&quot;/.guix-profile&quot;));
+    }
+
+  path = XtMalloc(bytesAllocd);
+  if (path == NULL) _XtAllocError(NULL);
+
+  memset (path, 0, bytesAllocd);
+
+  for (i = 0 ; i &lt; 6 ; ++i)
+    {
+      strcat (path, current_profile);
+      strcat (path, search_path_default_stem[i]);
+      strcat (path, &quot;:&quot;);
+    }
+
+  if (guix_profile != NULL)
+    for (i = 0 ; i &lt; 6 ; ++i)
+      {
+	strcat (path, guix_profile);
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, &quot;:&quot;);
+      }
+
+  if (home != NULL)
+    for (i = 0 ; i &lt; 6 ; ++i)
+      {
+	strcat (path, home);
+	strcat (path, &quot;/.guix-profile&quot;);
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, &quot;:&quot;);
+      }
+
+  /* Remove final : */
+  path[strlen(path) - 1] = &apos;\0&apos;;
 
-    return xfilesearchpath;
-#else
-    return XFILESEARCHPATHDEFAULT;
-#endif
+  return path;
 }
 
 
@@ -1353,7 +1430,7 @@ XtResolvePathname(Display *dpy,
 {
     XtPerDisplay pd;
     static const char *defaultPath = NULL;
-    const char *impl_default = implementation_default_path();
+    const char *impl_default = guix_default_path();
     int idef_len = (int) strlen(impl_default);
     char *massagedPath;
     int bytesAllocd, bytesLeft;
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
