mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Fix disk access path separator on Linux
This commit is contained in:
parent
a884fbf705
commit
e922042a3d
@ -800,7 +800,11 @@ void dispatch_run_script(const char*, const char* payload, uint8_t source)
|
|||||||
path[0] = '.';
|
path[0] = '.';
|
||||||
path[1] = '\0';
|
path[1] = '\0';
|
||||||
strcat(path, filename);
|
strcat(path, filename);
|
||||||
|
#if defined(WINDOWS)
|
||||||
path[1] = '\\';
|
path[1] = '\\';
|
||||||
|
#elif defined(POSIX)
|
||||||
|
path[1] = '/';
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_TRACE(TAG_HASP, F("Loading %s from disk..."), path);
|
LOG_TRACE(TAG_HASP, F("Loading %s from disk..."), path);
|
||||||
std::ifstream f(path); // taking file as inputstream
|
std::ifstream f(path); // taking file as inputstream
|
||||||
|
@ -244,7 +244,11 @@ void Page::load_jsonl(const char* pagesfile)
|
|||||||
path[0] = '.';
|
path[0] = '.';
|
||||||
path[1] = '\0';
|
path[1] = '\0';
|
||||||
strcat(path, pagesfile);
|
strcat(path, pagesfile);
|
||||||
|
#if defined(WINDOWS)
|
||||||
path[1] = '\\';
|
path[1] = '\\';
|
||||||
|
#elif defined(POSIX)
|
||||||
|
path[1] = '/';
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_TRACE(TAG_HASP, F("Loading %s from disk..."), path);
|
LOG_TRACE(TAG_HASP, F("Loading %s from disk..."), path);
|
||||||
std::ifstream f(path); // taking file as inputstream
|
std::ifstream f(path); // taking file as inputstream
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#if defined(POSIX)
|
#if defined(POSIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
#define cwd getcwd
|
#define cwd getcwd
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#if defined(POSIX)
|
#if defined(POSIX)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
#define cwd getcwd
|
#define cwd getcwd
|
||||||
#define cd chdir
|
#define cd chdir
|
||||||
#endif
|
#endif
|
||||||
@ -104,16 +105,19 @@ void InitializeConsoleOutput()
|
|||||||
|
|
||||||
void usage(const char* progName, const char* version)
|
void usage(const char* progName, const char* version)
|
||||||
{
|
{
|
||||||
std::cout
|
std::cout << "\n"
|
||||||
<< "\n"
|
|
||||||
<< progName << " " << version << " [options]" << std::endl
|
<< progName << " " << version << " [options]" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< "Options:" << std::endl
|
<< "Options:" << std::endl
|
||||||
<< " -h | --help Print this help" << std::endl
|
<< " -h | --help Print this help" << std::endl
|
||||||
<< " -W | --width Width of the window" << std::endl
|
<< " -W | --width Width of the window" << std::endl
|
||||||
<< " -H | --height Height of the window" << std::endl
|
<< " -H | --height Height of the window" << std::endl
|
||||||
<< " -C | --config Configuration directory (default: '~/.local/share/hasp' or 'AppData\\hasp\\hasp')"
|
<< " -C | --config Configuration directory" << std::endl
|
||||||
<< std::endl
|
#if defined(WINDOWS)
|
||||||
|
<< " (default: 'AppData\\hasp\\hasp')" << std::endl
|
||||||
|
#elif defined(POSIX)
|
||||||
|
<< " (default: '~/.local/share/hasp/hasp')" << std::endl
|
||||||
|
#endif
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user