Skip to content

Commit 2a69d7e

Browse files
prodrigestivilltrufae
authored andcommitted
Add workaround for macos bundled radare2 paths
1 parent 6427900 commit 2a69d7e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

dist/macos/scripts/command.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ R2_BINDIR="${APPDIR}/Contents/Helpers"
77
R2_LIBDIR="${APPDIR}/Contents/Frameworks"
88
R2_PREFIX="${APPDIR}/Contents/Resources/radare2"
99

10+
XDG_CACHE_HOME="${HOME}/Library/Caches/radareorg/iaito"
11+
XDG_CONFIG_HOME="${HOME}/Library/Preferences/radareorg/iaito"
12+
XDG_DATA_HOME="${HOME}/Library/Application Support/radareorg/iaito"
13+
1014
export R2_BINDIR
1115
export R2_LIBDIR
1216
export R2_PREFIX
17+
export XDG_CACHE_HOME
18+
export XDG_CONFIG_HOME
19+
export XDG_DATA_HOME
1320

1421
exec "${R2_BINDIR}/${CMD}" "$@"

src/IaitoApplication.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QLibraryInfo>
2626
#include <QPluginLoader>
2727
#include <QProcess>
28+
#include <QStandardPaths>
2829
#include <QStringList>
2930
#include <QTranslator>
3031
#ifdef Q_OS_WIN
@@ -160,6 +161,17 @@ IaitoApplication::IaitoApplication(int &argc, char **argv)
160161
// auto sleighHome = appdir; // Contents
161162
// sleighHome.cd("PlugIns/radare2/r2ghidra_sleigh"); // Contents/PlugIns/radare2/r2ghidra_sleigh
162163
// qputenv("SLEIGHHOME", sleighHome.absolutePath().toLocal8Bit());
164+
165+
// Allow bundled radare2 and its plugins to save its data inside iaito app folders
166+
qputenv(
167+
"XDG_CACHE_HOME",
168+
QStandardPaths::writableLocation(QStandardPaths::CacheLocation).toLocal8Bit());
169+
qputenv(
170+
"XDG_CONFIG_HOME",
171+
QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toLocal8Bit());
172+
qputenv(
173+
"XDG_DATA_HOME",
174+
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toLocal8Bit());
163175
}
164176
#endif
165177

0 commit comments

Comments
 (0)