Get reorganized code building on Windows
This commit is contained in:
parent
3c34a659a0
commit
5bc80cce96
11 changed files with 270 additions and 204 deletions
|
|
@ -10,9 +10,6 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#define LPSTR char *
|
||||
#define strtok_s strtok_r
|
||||
|
||||
LEDStripController::LEDStripController()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@
|
|||
#define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define LPSTR char *
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
class LEDStripController
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -6,13 +6,16 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectLEDStripControllers *
|
||||
|
|
@ -31,9 +34,16 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
|
|||
char filename[2048];
|
||||
char arg1[64];
|
||||
|
||||
#ifdef WIN32
|
||||
GetModuleFileName(NULL, filename, 2048);
|
||||
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
|
||||
strcat(filename, "\\settings.txt");
|
||||
#else
|
||||
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());
|
||||
#endif
|
||||
|
||||
strcat(filename, "/settings.txt");
|
||||
|
||||
//Open settings file
|
||||
|
|
@ -54,7 +64,7 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
|
|||
|
||||
value = (char *)line.c_str();
|
||||
|
||||
argument = strtok_r(value, "=", &value);
|
||||
argument = strtok_s(value, "=", &value);
|
||||
|
||||
//Strip off new line characters if present
|
||||
argument = strtok(argument, "\r\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue