Passing main argument to open session

This commit is contained in:
Bruno Herbelin
2022-01-07 11:10:28 +01:00
parent 0b4c42859d
commit 9834baedfa
2 changed files with 8 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
#define __UI_MANAGER_H_ #define __UI_MANAGER_H_
#include <string> #include <string>
#include <array>
#include <list> #include <list>
#include <gst/gstutils.h> #include <gst/gstutils.h>

View File

@@ -58,6 +58,8 @@ void renderGUI()
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
std::string _openfile;
// one extra argument is given // one extra argument is given
if (argc == 2) { if (argc == 2) {
std::string argument(argv[1]); std::string argument(argv[1]);
@@ -84,7 +86,8 @@ int main(int argc, char *argv[])
} }
else { else {
// try to open the file // try to open the file
Mixer::manager().load(argument); _openfile = argument;
fprintf(stderr, "Loading %s %s\n", argv[0], _openfile.c_str());
} }
} }
@@ -145,6 +148,9 @@ int main(int argc, char *argv[])
// show all windows // show all windows
Rendering::manager().show(); Rendering::manager().show();
// try to load file given in argument
Mixer::manager().load(_openfile);
/// ///
/// Main LOOP /// Main LOOP
/// ///