mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
FileManager: Show home directory by default, or command line argument
FileManager used to open up with the root directory loaded by default. Now it will try to load either 1) the first argument specified on the command line, 2) the user's home directory, or 3) the root directory. Fixes #389
This commit is contained in:
parent
9b6e99f17e
commit
fed0133109
Notes:
sideshowbarker
2024-07-19 12:58:31 +09:00
Author: https://github.com/deoxxa Commit: https://github.com/SerenityOS/serenity/commit/fed01331099 Pull-request: https://github.com/SerenityOS/serenity/pull/392
@ -222,7 +222,23 @@ int main(int argc, char** argv)
|
||||
progressbar->set_visible(true);
|
||||
};
|
||||
|
||||
directory_view->open("/");
|
||||
// our initial location is defined as, in order of precedence:
|
||||
// 1. the first command-line argument (e.g. FileManager /bin)
|
||||
// 2. the user's home directory
|
||||
// 3. the root directory
|
||||
|
||||
String initial_location;
|
||||
|
||||
if (argc >= 2)
|
||||
initial_location = argv[1];
|
||||
|
||||
if (initial_location.is_empty())
|
||||
initial_location = get_current_user_home_path();
|
||||
|
||||
if (initial_location.is_empty())
|
||||
initial_location = "/";
|
||||
|
||||
directory_view->open(initial_location);
|
||||
directory_view->set_focus(true);
|
||||
|
||||
window->set_main_widget(widget);
|
||||
|
Loading…
Reference in New Issue
Block a user