13
0

Setup stdio with -mwindows VST scanners

This commit is contained in:
Robin Gareus 2020-09-20 20:00:05 +02:00
parent 140e03bb7d
commit 25bd4b8ec7
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 18 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "pbd/pbd.h"
#include "pbd/transmitter.h"
#include "pbd/receiver.h"
#include "pbd/win_console.h"
#ifdef __MINGW64__
#define NO_OLDNAMES // no backwards compat _pid_t, conflict with w64 pthread/sched
@ -94,6 +95,7 @@ class DummyReceiver : public Receiver {
std::cerr << prefix << str << std::endl;
if (chn == Transmitter::Fatal) {
console_madness_end ();
::exit (EXIT_FAILURE);
}
}
@ -103,6 +105,8 @@ DummyReceiver dummy_receiver;
int main (int argc, char **argv) {
char *dllpath = NULL;
console_madness_begin ();
if (argc == 3 && !strcmp("-f", argv[1])) {
dllpath = argv[2];
const size_t slen = strlen (dllpath);
@ -118,6 +122,7 @@ int main (int argc, char **argv) {
}
else if (argc != 2) {
fprintf(stderr, "usage: %s [-f] <vst>\n", argv[0]);
console_madness_end ();
return EXIT_FAILURE;
} else {
dllpath = argv[1];
@ -157,6 +162,8 @@ int main (int argc, char **argv) {
PBD::cleanup();
console_madness_end ();
if (!infos || infos->empty()) {
return EXIT_FAILURE;
} else {

View File

@ -32,6 +32,7 @@
#include "pbd/transmitter.h"
#include "pbd/receiver.h"
#include "pbd/pbd.h"
#include "pbd/win_console.h"
#include "pbd/xml++.h"
#ifdef __MINGW64__
@ -70,6 +71,7 @@ protected:
std::cout << prefix << str << std::endl;
if (chn == Transmitter::Fatal) {
console_madness_end ();
::exit (EXIT_FAILURE);
}
}
@ -124,6 +126,8 @@ This tool ...\n\
printf ("Report bugs to <http://tracker.ardour.org/>\n"
"Website: <http://ardour.org/>\n");
console_madness_end ();
::exit (EXIT_SUCCESS);
}
@ -145,12 +149,15 @@ main (int argc, char **argv)
};
/* clang-format on */
console_madness_begin ();
int c = 0;
while (EOF != (c = getopt_long (argc, argv, optstring, longopts, (int*)0))) {
switch (c) {
case 'V':
printf ("ardour-vst3-scanner version %s\n\n", VERSIONSTRING);
printf ("Copyright (C) GPL 2020 Robin Gareus <robin@gareus.org>\n");
console_madness_end ();
exit (EXIT_SUCCESS);
break;
@ -168,6 +175,7 @@ main (int argc, char **argv)
default:
std::cerr << "Error: unrecognized option. See --help for usage information.\n";
console_madness_end ();
::exit (EXIT_FAILURE);
break;
}
@ -175,6 +183,7 @@ main (int argc, char **argv)
if (optind >= argc) {
std::cerr << "Error: Missing parameter. See --help for usage information.\n";
console_madness_end ();
::exit (EXIT_FAILURE);
}
@ -201,6 +210,8 @@ main (int argc, char **argv)
PBD::cleanup();
console_madness_end ();
if (err) {
return EXIT_FAILURE;
} else {