File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -443,9 +443,12 @@ The current API version in use by file-browser.
443
443
444
444
Adds the given extension to the default extension filter whitelist. Can only be run inside the ` setup() ` method.
445
445
446
- #### ` fb.browse_directory(directory: string): void `
446
+ #### ` fb.browse_directory(directory: string, open_browser: bool = true ): void `
447
447
448
- Clears the cache and opens the given directory in the browser. If the browser is closed then it will be opened.
448
+ Clears the cache and opens the given directory in the browser.
449
+ If the ` open_browser ` argument is truthy or ` nil ` then the browser will be opened
450
+ if it is currently closed. If ` open_browser ` is ` false ` then the directory will
451
+ be opened in the background.
449
452
This function is non-blocking, it is possible that the function will return before the directory has finished
450
453
being scanned.
451
454
Original file line number Diff line number Diff line change @@ -71,8 +71,10 @@ function controls.escape()
71
71
end
72
72
73
73
-- opens a specific directory
74
- function controls .browse_directory (directory )
74
+ function controls .browse_directory (directory , open_browser )
75
75
if not directory then return end
76
+ if open_browser == nil then open_browser = true end
77
+
76
78
directory = mp .command_native ({" expand-path" , directory }) or ' '
77
79
-- directory = join_path( mp.get_property("working-directory", ""), directory )
78
80
@@ -81,7 +83,7 @@ function controls.browse_directory(directory)
81
83
82
84
directory = fb_utils .resolve_directory_mapping (directory )
83
85
movement .goto_directory (directory )
84
- controls .open ()
86
+ if open_browser then controls .open () end
85
87
end
86
88
87
89
return controls
You can’t perform that action at this time.
0 commit comments