[vlmc-devel] main.cpp: Implement --no-gui option
Yikai Lu
git at videolan.org
Fri Jun 9 14:07:29 CEST 2017
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Fri Jun 9 20:56:56 2017 +0900| [4d542c629b7d30460cc50a43fa81c24f9dc30e16] | committer: Yikai Lu
main.cpp: Implement --no-gui option
> https://code.videolan.org/videolan/vlmc/commit/4d542c629b7d30460cc50a43fa81c24f9dc30e16
---
src/Main/main.cpp | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index c6b2c73b..5fbf4c2f 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -199,7 +199,11 @@ VLMCCoremain( int argc, char **argv )
/* Load a project file */
if ( app.arguments().count() < 3 )
{
- vlmcCritical() << "Usage: ./vlmc project.vlmc output_file";
+ vlmcCritical() << "Usage: ./vlmc "
+#ifdef HAVE_GUI
+ << "--no-gui "
+#endif
+ << "project.vlmc output_file";
return 1;
}
@@ -220,10 +224,15 @@ int
VLMCmain( int argc, char **argv )
{
#ifdef HAVE_GUI
- int res = VLMCGuimain( argc, argv );
+ if ( argc < 2 || strcmp( argv[1], "--no-gui" ) != 0 )
+ {
+ return VLMCGuimain( argc, argv );
+ }
+ // Remove --no-gui from argv
+ std::swap( argv[0], argv[1] );
+ return VLMCCoremain( argc - 1, argv + 1 );
#else
- int res = VLMCCoremain( argc, argv );
+ return VLMCCoremain( argc, argv );
#endif
- return res;
}
More information about the Vlmc-devel
mailing list