Skip to content

Commit c4da2a4

Browse files
deoxxaawesomekling
authored andcommitted
LibGUI: Define supported functions for using command line arguments
1 parent fabc717 commit c4da2a4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Libraries/LibGUI/GApplication.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ GApplication::GApplication(int argc, char** argv)
2323
s_the = this;
2424
m_event_loop = make<CEventLoop>();
2525
GWindowServerConnection::the();
26+
if (argc > 0)
27+
m_invoked_as = argv[0];
28+
for (int i = 1; i < argc; i++)
29+
m_args.append(argv[i]);
2630
}
2731

2832
GApplication::~GApplication()

Libraries/LibGUI/GApplication.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ class GApplication {
3535

3636
void did_delete_last_window(Badge<GWindow>);
3737

38+
const String& invoked_as() const { return m_invoked_as; }
39+
const Vector<String>& args() const { return m_args; }
40+
3841
private:
3942
OwnPtr<CEventLoop> m_event_loop;
4043
OwnPtr<GMenuBar> m_menubar;
4144
HashMap<GShortcut, GAction*> m_global_shortcut_actions;
4245
class TooltipWindow;
4346
TooltipWindow* m_tooltip_window { nullptr };
4447
bool m_quit_when_last_window_deleted { true };
48+
String m_invoked_as;
49+
Vector<String> m_args;
4550
};

0 commit comments

Comments
 (0)