mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-30 16:25:04 +00:00
Fix share path for AppImage
This commit is contained in:
parent
41be016467
commit
37b73ed223
@ -52,9 +52,9 @@ after_success:
|
|||||||
before_script:
|
before_script:
|
||||||
- git submodule init ; git submodule update
|
- git submodule init ; git submodule update
|
||||||
- cd radare2
|
- cd radare2
|
||||||
# Hack to modify r2 prefixes
|
|
||||||
- sed -i s,__WINDOWS__,1, libr/include/r_userconf.h.acr
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||||
|
# PREFIX modification for AppImage
|
||||||
|
PREFIX=/tmp/.cutter_usr/
|
||||||
INSTALL_TARGET=install sys/install.sh;
|
INSTALL_TARGET=install sys/install.sh;
|
||||||
else
|
else
|
||||||
LDFLAGS=-headerpad_max_install_names INSTALL_TARGET=install sys/install.sh;
|
LDFLAGS=-headerpad_max_install_names INSTALL_TARGET=install sys/install.sh;
|
||||||
|
36
src/main.cpp
36
src/main.cpp
@ -7,6 +7,28 @@
|
|||||||
#include "dialogs/NewFileDialog.h"
|
#include "dialogs/NewFileDialog.h"
|
||||||
#include "dialogs/OptionsDialog.h"
|
#include "dialogs/OptionsDialog.h"
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
|
#define SYMLINK "/tmp/.cutter_usr"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void set_appimage_symlink(char* argv0)
|
||||||
|
{
|
||||||
|
char* path = strdup(argv0);
|
||||||
|
char* i = strrchr(path, '/');
|
||||||
|
*(i+1) = '\0';
|
||||||
|
char* dest = strcat(path, "usr/");
|
||||||
|
struct stat buf;
|
||||||
|
if (lstat(SYMLINK, &buf) == 0 && S_ISLNK(buf.st_mode)) {
|
||||||
|
remove(SYMLINK);
|
||||||
|
}
|
||||||
|
symlink(dest, SYMLINK);
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
@ -21,7 +43,6 @@ int main(int argc, char *argv[])
|
|||||||
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
QCommandLineParser cmd_parser;
|
QCommandLineParser cmd_parser;
|
||||||
cmd_parser.setApplicationDescription(QObject::tr("A Qt and C++ GUI for radare2 reverse engineering framework"));
|
cmd_parser.setApplicationDescription(QObject::tr("A Qt and C++ GUI for radare2 reverse engineering framework"));
|
||||||
cmd_parser.addHelpOption();
|
cmd_parser.addHelpOption();
|
||||||
@ -85,5 +106,16 @@ int main(int argc, char *argv[])
|
|||||||
main->openNewFile(args[0], anal_level_specified ? anal_level : -1);
|
main->openNewFile(args[0], anal_level_specified ? anal_level : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.exec();
|
// Hack to make it work with AppImage
|
||||||
|
#ifdef __unix__
|
||||||
|
set_appimage_symlink(argv[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ret = a.exec();
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
|
remove(SYMLINK);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user