File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,31 @@ const char *
7070get_prefix (void )
7171{
7272 if (!prefix_valid ) {
73+ g_autofree char * basename = g_path_get_basename (main_argv0 );
74+ g_autofree char * pathname = path_find_file (basename );
75+
7376 const char * prefix ;
7477
75- if (!(prefix = vips_guess_prefix (main_argv0 , "VIPSHOME" ))) {
78+ prefix = vips_guess_prefix (main_argv0 , "VIPSHOME" );
79+
80+ if (!prefix ||
81+ !existsf ("%s/share/nip4" , prefix )) {
82+ /* the libvips guesser failed to find our install area ... try
83+ * using the path to our executable
84+ *
85+ * This can happon with homebrew, for example, where the
86+ * compile-time libvips prefix will not match the nip4 prefix
87+ */
88+ g_autofree char * trailing = g_strjoin ("/" , "bin" , basename , NULL );
89+ if (pathname &&
90+ is_postfix (pathname , trailing ))
91+ pathname [strlen (pathname ) - strlen (trailing )] = '\0' ;
92+
93+ prefix = pathname ;
94+ }
95+
96+ if (!prefix ||
97+ !existsf ("%s/share/nip4" , prefix )) {
7698 error_top (_ ("Unable to find install area" ));
7799 error_vips ();
78100
Original file line number Diff line number Diff line change @@ -1011,9 +1011,10 @@ mainwindow_size_images(VipsObject *object, size_t *size)
10111011void
10121012mainwindow_about (Mainwindow * main , VipsBuf * buf )
10131013{
1014+ vips_buf_appendf (buf , _ ("VIPSHOME = %s\n" ), g_getenv ("VIPSHOME" ));
1015+ vips_buf_appendf (buf , _ ("HOME = %s\n" ), g_getenv ("HOME" ));
10141016 vips_buf_appendf (buf , _ ("argv0 = %s\n" ), main_argv0 );
10151017 vips_buf_appendf (buf , _ ("prefix = %s\n" ), get_prefix ());
1016- vips_buf_appendf (buf , _ ("VIPSHOME = %s\n" ), g_getenv ("VIPSHOME" ));
10171018 vips_buf_appendf (buf , "\n" );
10181019
10191020 double sz = find_space (PATH_TMP );
You can’t perform that action at this time.
0 commit comments