Commit 2b2bd78c authored by Adam Honse's avatar Adam Honse

Reenable settings file parsing and uncomment strtok_r usage, but use strtok_s in Windows

parent dd9d9202
Pipeline #170834612 failed with stage
in 3 minutes and 59 seconds
......@@ -3,6 +3,11 @@
#include "KeyboardVisualizerCommon/Visualizer.h"
#include "KeyboardVisualizerCommon/VisualizerDefines.h"
#if defined(_WIN32) || defined(_WIN64)
/* We are on Windows */
# define strtok_r strtok_s
#endif
#ifndef WIN32
#include <unistd.h>
#endif
......@@ -159,7 +164,7 @@ bool parse_command_line(int argc, char *argv[])
char* argument;
char* value;
//argument = strtok_r(argv[i], "=", &value);
argument = strtok_r(argv[i], "=", &value);
if (strcmp(argument, "help") == 0)
{
......@@ -260,7 +265,7 @@ void parse_settings_file(char * filename)
value = (char *)line.c_str();
//argument = strtok_r(value, "=", &value);
argument = strtok_r(value, "=", &value);
parse_argument_string(argument, value);
}
......@@ -277,16 +282,8 @@ int main(int argc, char *argv[])
//Initialize Visualizer
vis.Initialize();
//Get file path in executable directory
//char filename[2048];
//GetModuleFileName(NULL, filename, 2048);
//char arg1[64];
//snprintf(arg1, 64, "/proc/%d/exe", getpid());
//readlink(arg1, filename, 1024);
//strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
//strcat(filename, "\\settings.txt");
//strcat(filename, "/settings.txt");
//parse_settings_file(filename);
//Parse Settings File
parse_settings_file("settings.txt");
//Parse Command Line
if (!parse_command_line(argc, argv))
......
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