mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix: store IPC file in application directory (#5226)
This commit is contained in:
parent
3c13e0c6d2
commit
449c5397b7
|
@ -40,6 +40,7 @@
|
|||
- Minor: Allow theming of tab live and rerun indicators. (#5188)
|
||||
- Minor: Added a fallback theme field to custom themes that will be used in case the custom theme does not contain a color Chatterino needs. If no fallback theme is specified, we'll pull the color from the included Dark or Light theme. (#5198)
|
||||
- Minor: Image links now reflect the scale of their image instead of an internal label. (#5201)
|
||||
- Minor: IPC files are now stored in the Chatterino directory instead of system directories on Windows. (#5226)
|
||||
- Minor: 7TV emotes now have a 4x image rather than a 3x image. (#5209)
|
||||
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
||||
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Updates.hpp"
|
||||
#include "util/AttachToConsole.hpp"
|
||||
#include "util/IpcQueue.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
@ -62,6 +63,7 @@ int main(int argc, char **argv)
|
|||
box.exec();
|
||||
return 1;
|
||||
}
|
||||
ipc::initPaths(paths.get());
|
||||
|
||||
const Args args(a, *paths);
|
||||
|
||||
|
|
|
@ -140,6 +140,13 @@ void Paths::initSubDirectories()
|
|||
this->pluginsDirectory = makePath("Plugins");
|
||||
this->themesDirectory = makePath("Themes");
|
||||
this->crashdumpDirectory = makePath("Crashes");
|
||||
#ifdef Q_OS_WIN
|
||||
this->ipcDirectory = makePath("IPC");
|
||||
#else
|
||||
// NOTE: We do *NOT* use IPC on non-Windows platforms.
|
||||
// If we start, we should re-consider this directory.
|
||||
this->ipcDirectory = "/tmp";
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -39,6 +39,11 @@ public:
|
|||
// Custom themes live here. <appDataDirectory>/Themes
|
||||
QString themesDirectory;
|
||||
|
||||
// Directory for shared memory files.
|
||||
// <appDataDirectory>/IPC on Windows
|
||||
// /tmp elsewhere
|
||||
QString ipcDirectory;
|
||||
|
||||
bool createFolder(const QString &folderPath);
|
||||
[[deprecated("use Modes::instance().portable instead")]] bool isPortable()
|
||||
const;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "util/IpcQueue.hpp"
|
||||
|
||||
#include "common/QLogging.hpp"
|
||||
#include "singletons/Paths.hpp"
|
||||
|
||||
#define BOOST_INTERPROCESS_SHARED_DIR_FUNC
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
@ -9,8 +11,49 @@
|
|||
|
||||
namespace boost_ipc = boost::interprocess;
|
||||
|
||||
namespace {
|
||||
|
||||
static const chatterino::Paths *PATHS = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace boost::interprocess::ipcdetail {
|
||||
|
||||
void get_shared_dir(std::string &shared_dir)
|
||||
{
|
||||
if (!PATHS)
|
||||
{
|
||||
assert(false && "PATHS not set");
|
||||
qCCritical(chatterinoNativeMessage)
|
||||
<< "PATHS not set for shared directory";
|
||||
return;
|
||||
}
|
||||
shared_dir = PATHS->ipcDirectory.toStdString();
|
||||
}
|
||||
|
||||
#ifdef BOOST_INTERPROCESS_WINDOWS
|
||||
void get_shared_dir(std::wstring &shared_dir)
|
||||
{
|
||||
if (!PATHS)
|
||||
{
|
||||
assert(false && "PATHS not set");
|
||||
qCCritical(chatterinoNativeMessage)
|
||||
<< "PATHS not set for shared directory";
|
||||
return;
|
||||
}
|
||||
shared_dir = PATHS->ipcDirectory.toStdWString();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost::interprocess::ipcdetail
|
||||
|
||||
namespace chatterino::ipc {
|
||||
|
||||
void initPaths(const Paths *paths)
|
||||
{
|
||||
PATHS = paths;
|
||||
}
|
||||
|
||||
void sendMessage(const char *name, const QByteArray &data)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -6,8 +6,16 @@
|
|||
class QByteArray;
|
||||
class QString;
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Paths;
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
namespace chatterino::ipc {
|
||||
|
||||
void initPaths(const Paths *paths);
|
||||
|
||||
void sendMessage(const char *name, const QByteArray &data);
|
||||
|
||||
class IpcQueuePrivate;
|
||||
|
|
Loading…
Reference in a new issue