Commit d974ab4b authored by Gargaj's avatar Gargaj
Browse files

print current directory when loading config.json

parent fa8053b2
......@@ -24,7 +24,9 @@ For the OpenGL version (for any platform), at least OpenGL 4.1 is required.
On recent macOS, to allow sound input to be captured (for FFT textures to be generated), you need to: Open up System Preferences, click on Security & Privacy, click on the Privacy tab then click on the Microphone menu item. Make sure is in the list and ticked.
## Configuration
Create a `config.json` and place it next to the executable with e.g. the following contents: (all fields are optional)
You can configure Bonzomatic by creating a `config.json` and placing it next to the binary executable you're planning to run in the working directory for the binary; Bonzomatic will helpfully print this directory out for you when you run it, and you can also pass a file (with absolute or relative path, whichever you want) to load any other file as `config.json`. This allows you to have multiple configurations for multiple situations.
The file can have the following contents: (all fields are optional)
``` javascript
"window":{ // default window size / state, if there's a setup dialog, it will override it
......@@ -32,7 +34,7 @@ Create a `config.json` and place it next to the executable with e.g. the followi
"font":{ // all paths in the file are also relative to the binary, but again, can be absolute paths if that's more convenient
......@@ -2,6 +2,13 @@
#include <string.h>
#include <assert.h>
#ifdef _WIN32
#include <direct.h>
#define getcwd _getcwd
#include <unistd.h>
#include "ShaderEditor.h"
#include "Renderer.h"
#include "FFT.h"
......@@ -45,8 +52,23 @@ int main(int argc, const char *argv[])
const char * configFile = "config.json";
if ( argc > 1 )
configFile = argv[ 1 ];
printf( "Loading config file '%s'...\n", configFile );
char configPath[ 256 ] = { 0 };
if ( getcwd( configPath, 255 ) )
printf( "Looking for config.json in '%s'...\n", configPath );
jsonxx::Object options;
FILE * fConf = fopen( (argc > 1) ? argv[1] : "config.json","rb");
FILE * fConf = fopen( configFile, "rb" );
if (fConf)
printf("Config file found, parsing...\n");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment