Something went wrong. Try again.
The agentic engineering control plane for the posthuman future
Something went wrong. Try again.
1.8 kB · 53 lines
C++
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#include "XenoPaths.h"
#include <QCoreApplication>#include <QDir>#include <QFile>#include <QFileInfo>#include <QStandardPaths>
namespace xeno::paths {
QString configDir() { // XDG Base Directory spec: configuration lives under $XDG_CONFIG_HOME, // defaulting to ~/.config. Same convention the app's existing ConfigPaths // and XenoSettings use, so everything lands in one directory. QString base = QString::fromLocal8Bit(qgetenv("XDG_CONFIG_HOME")); if (base.isEmpty()) { base = QDir::home().filePath(QStringLiteral(".config")); } return QDir(base).filePath(QStringLiteral("xenomorphic"));}
QString daemonJsonPath() { return QDir(configDir()).filePath(QStringLiteral("daemon.json"));}
QString daemonLockPath() { return QDir(configDir()).filePath(QStringLiteral("daemon.lock"));}
QString daemonLogPath() { return QDir(configDir()).filePath(QStringLiteral("daemon.log"));}
QString daemonExecutable() { // $XENO_DAEMON_PATH: test/dev override. The returned locals are non-const so // the implicit move on return applies (performance-no-automatic-move). QString overridePath = QString::fromLocal8Bit(qgetenv("XENO_DAEMON_PATH")); if (!overridePath.isEmpty() && QFile::exists(overridePath)) { return overridePath; } // Both binaries install into bin/ (dev shell: build/bin/, Nix: $out/bin/), // so the sibling of the running executable is the normal case. const QString appDir = QFileInfo(QCoreApplication::applicationFilePath()).absolutePath(); QString sibling = QDir(appDir).filePath(QStringLiteral("xenomorphicd")); if (QFile::exists(sibling)) { return sibling; } // Last resort: an unwrapped or relocated install reachable via PATH. return QStandardPaths::findExecutable(QStringLiteral("xenomorphicd"));}
} // namespace xeno::paths