refactor: Make Args less of a singleton (#5041)
This means it's no longer a singleton, and its lifetime is bound to our application. This felt like a good small experiment to see how its changes would look if we did this. As a shortcut, `getApp` that is already a mega singleton keeps a reference to Args, this means places that are a bit more difficult to inject into call `getApp()->getArgs()` just like other things are accessed.
This commit is contained in:
+6
-6
@@ -62,18 +62,18 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
initArgs(a);
|
||||
const Args args(a);
|
||||
|
||||
#ifdef CHATTERINO_WITH_CRASHPAD
|
||||
const auto crashpadHandler = installCrashHandler();
|
||||
const auto crashpadHandler = installCrashHandler(args);
|
||||
#endif
|
||||
|
||||
// run in gui mode or browser extension host mode
|
||||
if (getArgs().shouldRunBrowserExtensionHost)
|
||||
if (args.shouldRunBrowserExtensionHost)
|
||||
{
|
||||
runBrowserExtensionHost();
|
||||
}
|
||||
else if (getArgs().printVersion)
|
||||
else if (args.printVersion)
|
||||
{
|
||||
attachToConsole();
|
||||
|
||||
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getArgs().verbose)
|
||||
if (args.verbose)
|
||||
{
|
||||
attachToConsole();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Settings settings(paths->settingsDirectory);
|
||||
|
||||
runGui(a, *paths, settings);
|
||||
runGui(a, *paths, settings, args);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user