@@ -36,63 +36,80 @@ public class SearchPaths {
3636 string bundle_path = (BirdFont . bundle_path != null ) ? (! ) BirdFont . bundle_path : " " ;
3737
3838 resources = (is_null (resources_folder)) ? " " : resources_folder;
39+
40+ string ? current_program = GLib . FileUtils . read_link (" /proc/self/exe" );
41+
42+ if (current_program != null ) {
43+ string program = (! ) current_program;
44+ int separator = program. last_index_of (" /" );
45+
46+ if (separator > - 1 ) {
47+ string folder = program. substring (0 , separator);
48+
49+ f = get_file (folder + " /../" + d + " /" , name);
50+ if (f. query_exists ()) return f;
51+
52+ f = get_file (folder + " /../" , name);
53+ if (f. query_exists ()) return f;
54+ }
55+ }
3956
4057 f = get_file (resources + " /" + d + " /" , name);
41- if (likely ( f. query_exists () )) return f;
58+ if (f. query_exists ()) return f;
4259
4360 f = get_file (resources + " /" , name);
44- if (likely ( f. query_exists () )) return f;
61+ if (f. query_exists ()) return f;
4562
4663 f = get_file (" resources/" , name);
47- if (likely ( f. query_exists () )) return f;
64+ if (f. query_exists ()) return f;
4865
4966 f = get_file (resources + " /" , name + " /" );
50- if (likely ( f. query_exists () )) return f;
67+ if (f. query_exists ()) return f;
5168
5269 f = get_file (BirdFont . exec_path + " /" + d + " /" , name);
53- if (likely ( f. query_exists () )) return f;
70+ if (f. query_exists ()) return f;
5471
5572 f = get_file (BirdFont . exec_path + " /" , name + " /" );
56- if (likely ( f. query_exists () )) return f;
73+ if (f. query_exists ()) return f;
5774
5875 f = get_file (BirdFont . exec_path + " \\ " + d + " \\ " , name);
59- if (likely ( f. query_exists () )) return f;
76+ if (f. query_exists ()) return f;
6077
6178 f = get_file (BirdFont . exec_path + " \\ " , name + " \\ " );
62- if (likely ( f. query_exists () )) return f;
79+ if (f. query_exists ()) return f;
6380
6481 f = get_file (bundle_path + " /Contents/Resources/birdfont_resources/" , d + " /" + name);
65- if (likely ( f. query_exists () )) return f;
82+ if (f. query_exists ()) return f;
6683
6784 f = get_file (bundle_path + " /Contents/Resources/birdfont_resources/" , name + " /" );
68- if (likely ( f. query_exists () )) return f;
85+ if (f. query_exists ()) return f;
6986
7087 f = get_file (" ./" + d + " /" , name);
71- if (likely ( f. query_exists () )) return f;
88+ if (f. query_exists ()) return f;
7289
7390 f = get_file (" ../" + d + " /" , name);
74- if (likely ( f. query_exists () )) return f;
91+ if (f. query_exists ()) return f;
7592
7693 f = get_file (" .\\ " + d + " \\ " , name);
77- if (likely ( f. query_exists () )) return f;
94+ if (f. query_exists ()) return f;
7895
7996 f = get_file (" " , name);
80- if (likely ( f. query_exists () )) return f;
97+ if (f. query_exists ()) return f;
8198
8299 f = get_file (d + " \\ " , name);
83- if (likely ( f. query_exists () )) return f;
100+ if (f. query_exists ()) return f;
84101
85102 f = get_file (@" $PREFIX /share/birdfont/" + d + " /" , name);
86- if (likely ( f. query_exists () )) return f;
103+ if (f. query_exists ()) return f;
87104
88105 f = get_file (@" /usr/local/share/birdfont/" + d + " /" , name);
89- if (likely ( f. query_exists () )) return f;
106+ if (f. query_exists ()) return f;
90107
91108 f = get_file (@" resources/linux/" , name);
92- if (likely ( f. query_exists () )) return f;
109+ if (f. query_exists ()) return f;
93110
94111 f = get_file (@" /usr/share/birdfont/" + d + " /" , name);
95- if (likely ( f. query_exists () )) return f;
112+ if (f. query_exists ()) return f;
96113
97114 return f;
98115 }
0 commit comments