Use PATH_MAX constant, prevent -Wunused-variable, remove commented out code and needless std::string
This commit is contained in:
parent
29f8c7123a
commit
36fae187f3
|
|
@ -67,12 +67,14 @@ RB_METHOD(nikoStart)
|
||||||
std::string journal;
|
std::string journal;
|
||||||
|
|
||||||
// Get current path
|
// Get current path
|
||||||
getcwd(path, sizeof(path));
|
if (getcwd(path, sizeof(path)) == NULL) {
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OS_OSX
|
#ifdef OS_OSX
|
||||||
journal = std::string(path) + std::string("/_______.app/Contents/MacOS/_______");
|
journal = std::string(path) + "/_______.app/Contents/MacOS/_______";
|
||||||
#else
|
#else
|
||||||
journal = std::string(path) + std::string("/_______");
|
journal = std::string(path) + "/_______";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Run the binary
|
// Run the binary
|
||||||
|
|
@ -81,24 +83,6 @@ RB_METHOD(nikoStart)
|
||||||
execl(journal.c_str(), journal.c_str(), x_str, y_str, (char*)0);
|
execl(journal.c_str(), journal.c_str(), x_str, y_str, (char*)0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ssize_t len = readlink("/proc/self/exe", path, PATH_MAX);
|
|
||||||
// if (len > 0) {
|
|
||||||
// // Replace filename
|
|
||||||
// for (size_t i = len; i > 0; --i) {
|
|
||||||
// if (path[i-1] == '/') {
|
|
||||||
// strcpy(path + i, "_______");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // Run the binary
|
|
||||||
// pid_t pid = fork();
|
|
||||||
// if (pid == 0) {
|
|
||||||
// execl(path, "_______", x_str, y_str, (char*)0);
|
|
||||||
|
|
||||||
// exit(1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static bool isCached = false;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
static WCHAR szStyle[8] = {0};
|
static WCHAR szStyle[8] = {0};
|
||||||
|
|
@ -16,9 +14,11 @@ static bool isCached = false;
|
||||||
static DWORD szTileSize = sizeof(szTile) - 1;
|
static DWORD szTileSize = sizeof(szTile) - 1;
|
||||||
static bool setStyle = false;
|
static bool setStyle = false;
|
||||||
static bool setTile = false;
|
static bool setTile = false;
|
||||||
|
static bool isCached = false;
|
||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "mac-desktop.h"
|
#include "mac-desktop.h"
|
||||||
|
static bool isCached = false;
|
||||||
#else
|
#else
|
||||||
#include <giomm/settings.h>
|
#include <giomm/settings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -120,7 +120,7 @@ end:
|
||||||
}
|
}
|
||||||
MacDesktop::ChangeBackground(shState->config().gameFolder + path, ((color >> 16) & 0xFF) / 255.0, ((color >> 8) & 0xFF) / 255.0, ((color) & 0xFF) / 255.0);
|
MacDesktop::ChangeBackground(shState->config().gameFolder + path, ((color >> 16) & 0xFF) / 255.0, ((color >> 8) & 0xFF) / 255.0, ((color) & 0xFF) / 255.0);
|
||||||
#else
|
#else
|
||||||
char gameDir[1024];
|
char gameDir[PATH_MAX];
|
||||||
if (getcwd(gameDir, sizeof(gameDir)) != NULL) {
|
if (getcwd(gameDir, sizeof(gameDir)) != NULL) {
|
||||||
std::string gameDirStr(gameDir);
|
std::string gameDirStr(gameDir);
|
||||||
std::stringstream hexColor;
|
std::stringstream hexColor;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue