diff --git a/libaegisub/common/path.cpp b/libaegisub/common/path.cpp index 05f1fd74f..b3a171fc9 100644 --- a/libaegisub/common/path.cpp +++ b/libaegisub/common/path.cpp @@ -92,9 +92,9 @@ fs::path Path::MakeRelative(fs::path const& path, fs::path const& base) const { } fs::path Path::MakeAbsolute(fs::path path, std::string const& token) const { + if (path.empty()) return path; const auto it = tokens.find(token); if (it == tokens.end()) throw agi::InternalError("Bad token: " + token, nullptr); - if (path.empty()) return path; path.make_preferred(); const auto str = path.string(); diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index 098168588..4ee7dae6f 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -271,10 +271,6 @@ namespace { PUSH_FIELD(export_filters); PUSH_FIELD(export_encoding); PUSH_FIELD(style_storage); - PUSH_FIELD(audio_file); - PUSH_FIELD(video_file); - PUSH_FIELD(timecodes_file); - PUSH_FIELD(keyframes_file); PUSH_FIELD(video_zoom); PUSH_FIELD(ar_value); PUSH_FIELD(scroll_position); @@ -282,6 +278,10 @@ namespace { PUSH_FIELD(ar_mode); PUSH_FIELD(video_position); #undef PUSH_FIELD + set_field(L, "audio_file", config::path->MakeAbsolute(c->ass->Properties.audio_file, "?script")); + set_field(L, "video_file", config::path->MakeAbsolute(c->ass->Properties.video_file, "?script")); + set_field(L, "timecodes_file", config::path->MakeAbsolute(c->ass->Properties.timecodes_file, "?script")); + set_field(L, "keyframes_file", config::path->MakeAbsolute(c->ass->Properties.keyframes_file, "?script")); } return 1; }