forked from Ivasoft/DSView
Fix error of can't find res path
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -46,3 +46,4 @@ libsigrok4DSL/version.h
|
|||||||
|
|
||||||
DSView-prj
|
DSView-prj
|
||||||
build*
|
build*
|
||||||
|
share
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ if(ENABLE_COTIRE)
|
|||||||
include(cotire)
|
include(cotire)
|
||||||
cotire(${PROJECT_NAME})
|
cotire(${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "/usr/local/lib")
|
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
#= Installation
|
#= Installation
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
char DS_RES_PATH[256];
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
@@ -113,6 +115,20 @@ int main(int argc, char *argv[])
|
|||||||
} else if (argc - optind == 1)
|
} else if (argc - optind == 1)
|
||||||
open_file = argv[argc - 1];
|
open_file = argv[argc - 1];
|
||||||
|
|
||||||
|
// Initialise DS_RES_PATH
|
||||||
|
QDir dir(QCoreApplication::applicationDirPath());
|
||||||
|
if (dir.cd("..") &&
|
||||||
|
dir.cd("share") &&
|
||||||
|
dir.cd(QApplication::applicationName()) &&
|
||||||
|
dir.cd("res")) {
|
||||||
|
QString res_dir = dir.absolutePath() + "/";
|
||||||
|
QByteArray str_tmp = res_dir.toLocal8Bit();
|
||||||
|
strcpy(DS_RES_PATH, str_tmp.data());
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR: config files don't exist.";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialise libsigrok
|
// Initialise libsigrok
|
||||||
if (sr_init(&sr_ctx) != SR_OK) {
|
if (sr_init(&sr_ctx) != SR_OK) {
|
||||||
qDebug() << "ERROR: libsigrok init failed.";
|
qDebug() << "ERROR: libsigrok init failed.";
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ enum {
|
|||||||
|
|
||||||
#define DS_MAX_TRIG_PERCENT 90
|
#define DS_MAX_TRIG_PERCENT 90
|
||||||
|
|
||||||
#define DS_RES_PATH "/usr/local/share/DSView/res/"
|
extern char DS_RES_PATH[256];
|
||||||
|
|
||||||
/** libsigrok loglevels. */
|
/** libsigrok loglevels. */
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
Reference in New Issue
Block a user