prepare standalone VST scanner tool.. part one
[ardour.git] / libs / fst / scanner.cc
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <vector>
5
6 #include "ardour/filesystem_paths.h"
7 #include "ardour/linux_vst_support.h"
8 #include "ardour/vst_info_file.h"
9
10 /* make stupid waf happy.
11  * waf cannot build multiple variants of .o object files from the same
12  * source using different wscripts.. it mingles e.g.
13  * build/libs/ardour/vst_info_file.cc.1.o for
14  * both lib/ardour/wscript and lib/fst/wscript
15  *
16  * ...but waf does track include dependencies.
17  */
18 #include "../ardour/vst_info_file.cc"
19 #include "../ardour/linux_vst_support.cc"
20 #include "../ardour/filesystem_paths.cc"
21 #include "../ardour/directory_names.cc"
22 #include "../pbd/error.cc"
23 #include "../pbd/basename.cc"
24 #include "../pbd/search_path.cc"
25 #include "../pbd/transmitter.cc"
26 #include "../pbd/whitespace.cc"
27
28 #ifdef LXVST_SUPPORT
29 void
30 vstfx_destroy_editor (VSTState* /*vstfx*/) { }
31 #endif
32
33 int main (int argc, char **argv) {
34         if (argc != 2) {
35                 fprintf(stderr, "usage: %s <vst>\n", argv[0]);
36                 return EXIT_FAILURE;
37         }
38
39         char *dllpath = argv[1];
40         std::vector<VSTInfo *> *infos;
41 #ifdef LXVST_SUPPORT
42         if (strstr (dllpath, ".so" ) == 0) {
43                 infos = vstfx_get_info_lx(dllpath);
44         }
45 #endif
46
47 #ifdef WINDOWS_VST_SUPPORT
48         if (strstr (dllpath, ".dll" ) == 0) {
49                 infos = vstfx_get_info_fst(dllpath);
50         }
51 #endif
52
53         if (infos->empty()) {
54                 return EXIT_FAILURE;
55         } else {
56                 return EXIT_SUCCESS;
57         }
58 }
59