File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,21 @@ inline bool file_exists(const char *path) {
267
267
void llua_load (const char *script) {
268
268
int error;
269
269
270
- std::filesystem::path path = to_real_path (script);
270
+ std::filesystem::path path;
271
+ std::filesystem::path script_path (script);
272
+
273
+ if (!script_path.is_absolute ()) {
274
+ auto cfg_path = std::filesystem::path (to_real_path (XDG_CONFIG_FILE));
275
+ auto cfg_dir = cfg_path.parent_path ();
276
+
277
+ // prepend the config directory to the script path
278
+ auto full = cfg_dir / script_path;
279
+ path = to_real_path (full.c_str ());
280
+ }
281
+ else {
282
+ // Already an absolute path
283
+ path = to_real_path (script);
284
+ }
271
285
272
286
if (!file_exists (path.c_str ())) {
273
287
bool found_alternative = false ;
You can’t perform that action at this time.
0 commit comments