refactor: normalize get_default_directory()
This commit is contained in:
8
uosc.lua
8
uosc.lua
@@ -543,6 +543,10 @@ function get_extension(path)
|
|||||||
return parts and #parts > 1 and parts[#parts] or nil
|
return parts and #parts > 1 and parts[#parts] or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function get_default_directory()
|
||||||
|
return mp.command_native({'expand-path', options.default_directory})
|
||||||
|
end
|
||||||
|
|
||||||
-- Serializes path into its semantic parts
|
-- Serializes path into its semantic parts
|
||||||
function serialize_path(path)
|
function serialize_path(path)
|
||||||
if not path or is_protocol(path) then return end
|
if not path or is_protocol(path) then return end
|
||||||
@@ -3723,7 +3727,7 @@ mp.add_key_binding(nil, 'load-subtitles', function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not path then
|
if not path then
|
||||||
path = mp.command_native({'expand-path', options.default_directory})
|
path = get_default_directory()
|
||||||
end
|
end
|
||||||
open_file_navigation_menu(
|
open_file_navigation_menu(
|
||||||
path,
|
path,
|
||||||
@@ -3865,7 +3869,7 @@ mp.add_key_binding(nil, 'open-file', function()
|
|||||||
local active_file
|
local active_file
|
||||||
|
|
||||||
if path == nil or is_protocol(path) then
|
if path == nil or is_protocol(path) then
|
||||||
local serialized = serialize_path(mp.command_native({'expand-path', options.default_directory}))
|
local serialized = serialize_path(get_default_directory())
|
||||||
if serialized then
|
if serialized then
|
||||||
directory = serialized.path
|
directory = serialized.path
|
||||||
active_file = nil
|
active_file = nil
|
||||||
|
Reference in New Issue
Block a user