2018-02-10 18:04:31 +00:00
|
|
|
#include "CutterApplication.h"
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "MainWindow.h"
|
2017-09-25 12:55:41 +00:00
|
|
|
|
2017-12-09 22:01:30 +00:00
|
|
|
#ifdef APPIMAGE
|
2017-10-23 09:37:30 +00:00
|
|
|
#define PREFIX "/tmp/.cutter_usr"
|
2017-10-23 09:22:15 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-10-24 08:18:16 +00:00
|
|
|
void set_appimage_symlink()
|
2017-10-23 09:22:15 +00:00
|
|
|
{
|
2017-11-03 17:22:54 +00:00
|
|
|
char *path = realpath("/proc/self/exe", NULL);
|
|
|
|
char *i = strrchr(path, '/');
|
|
|
|
*(i + 1) = '\0';
|
|
|
|
char *dest = strcat(path, "../");
|
2017-10-23 09:22:15 +00:00
|
|
|
struct stat buf;
|
2018-03-21 20:32:32 +00:00
|
|
|
if (lstat(PREFIX, &buf) == 0 && S_ISLNK(buf.st_mode)) {
|
2017-10-23 09:37:30 +00:00
|
|
|
remove(PREFIX);
|
2017-10-23 09:22:15 +00:00
|
|
|
}
|
2017-10-23 09:37:30 +00:00
|
|
|
symlink(dest, PREFIX);
|
2017-10-23 21:54:35 +00:00
|
|
|
printf("'%s' '%s' '%s'\n", path, i, dest);
|
2017-10-23 09:22:15 +00:00
|
|
|
free(path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2017-10-23 09:22:15 +00:00
|
|
|
// Hack to make it work with AppImage
|
2017-12-09 22:01:30 +00:00
|
|
|
#ifdef APPIMAGE
|
2017-10-24 08:18:16 +00:00
|
|
|
set_appimage_symlink();
|
2017-10-23 09:22:15 +00:00
|
|
|
#endif
|
|
|
|
|
2018-03-09 16:06:41 +00:00
|
|
|
CutterApplication a(argc, argv);
|
|
|
|
|
2017-10-23 09:22:15 +00:00
|
|
|
int ret = a.exec();
|
|
|
|
|
2017-12-09 22:01:30 +00:00
|
|
|
#ifdef APPIMAGE
|
2017-10-23 09:37:30 +00:00
|
|
|
remove(PREFIX);
|
2017-10-23 09:22:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return ret;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|