3
3
#include " KeyboardVisualizerCommon/Visualizer.h"
4
4
#include " KeyboardVisualizerCommon/VisualizerDefines.h"
5
5
6
+ #if defined(_WIN32) || defined(_WIN64)
7
+ /* We are on Windows */
8
+ # define strtok_r strtok_s
9
+ #endif
10
+
6
11
#ifndef WIN32
7
12
#include < unistd.h>
8
13
#endif
@@ -159,7 +164,7 @@ bool parse_command_line(int argc, char *argv[])
159
164
char * argument;
160
165
char * value;
161
166
162
- // argument = strtok_r(argv[i], "=", &value);
167
+ argument = strtok_r (argv[i], " =" , &value);
163
168
164
169
if (strcmp (argument, " help" ) == 0 )
165
170
{
@@ -260,7 +265,7 @@ void parse_settings_file(char * filename)
260
265
261
266
value = (char *)line.c_str ();
262
267
263
- // argument = strtok_r(value, "=", &value);
268
+ argument = strtok_r (value, " =" , &value);
264
269
265
270
parse_argument_string (argument, value);
266
271
}
@@ -277,16 +282,8 @@ int main(int argc, char *argv[])
277
282
// Initialize Visualizer
278
283
vis.Initialize ();
279
284
280
- // Get file path in executable directory
281
- // char filename[2048];
282
- // GetModuleFileName(NULL, filename, 2048);
283
- // char arg1[64];
284
- // snprintf(arg1, 64, "/proc/%d/exe", getpid());
285
- // readlink(arg1, filename, 1024);
286
- // strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
287
- // strcat(filename, "\\settings.txt");
288
- // strcat(filename, "/settings.txt");
289
- // parse_settings_file(filename);
285
+ // Parse Settings File
286
+ parse_settings_file (" settings.txt" );
290
287
291
288
// Parse Command Line
292
289
if (!parse_command_line (argc, argv))
0 commit comments