[vlmc-devel] main.cpp: Implement --no-gui option
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Jun 9 17:42:01 CEST 2017
On Fri, Jun 9, 2017, at 02:07 PM, Yikai Lu wrote:
> 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 )
Shouldn't you look for this argument in the all the command line
arguments?
> + {
> + 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;
> }
>
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the Vlmc-devel
mailing list