mirror of https://github.com/BOINC/boinc.git
Merge pull request #1820 from BOINC/fix_issue-1177
Manager/Lib: fix 'New Manager window' function on Linux
This commit is contained in:
commit
40b7eb90c5
|
@ -724,6 +724,16 @@ void CBOINCGUIApp::DetectExecutableName() {
|
|||
|
||||
// Store the root directory for later use.
|
||||
m_strBOINCMGRExecutableName = pszProg;
|
||||
#elif defined(__WXGTK__)
|
||||
char path[PATH_MAX];
|
||||
if (!get_real_executable_path(path, PATH_MAX)) {
|
||||
// find filename component
|
||||
char* name = strrchr(path, '/');
|
||||
if (name) {
|
||||
name++;
|
||||
m_strBOINCMGRExecutableName = name;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -745,6 +755,17 @@ void CBOINCGUIApp::DetectRootDirectory() {
|
|||
|
||||
// Store the root directory for later use.
|
||||
m_strBOINCMGRRootDirectory = szPath;
|
||||
#elif defined(__WXGTK__)
|
||||
char path[PATH_MAX];
|
||||
if (!get_real_executable_path(path, PATH_MAX)) {
|
||||
// find path component
|
||||
char* name = strrchr(path, '/');
|
||||
if (name) {
|
||||
name++;
|
||||
*name = '\0';
|
||||
m_strBOINCMGRRootDirectory = path;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1017,6 +1017,11 @@ if test -e "/proc/self/stat"; then
|
|||
AC_DEFINE(HAVE__PROC_SELF_STAT, 1, [Define to 1 if /proc/self/stat exists])
|
||||
fi
|
||||
|
||||
dnl Check for /proc/self/exe (Linux)
|
||||
if test -e "/proc/self/exe"; then
|
||||
AC_DEFINE(HAVE__PROC_SELF_EXE, 1, [Define to 1 if /proc/self/exe exists])
|
||||
fi
|
||||
|
||||
dnl Check for /proc/meminfo (Linux)
|
||||
if test -e "/proc/meminfo"; then
|
||||
AC_DEFINE(HAVE__PROC_MEMINFO, 1, [Define to 1 if /proc/meminfo exists])
|
||||
|
|
21
lib/util.cpp
21
lib/util.cpp
|
@ -625,3 +625,24 @@ double rand_normal() {
|
|||
cached = true;
|
||||
return z*cos(PI2*u2);
|
||||
}
|
||||
|
||||
// determines the real path and filename of the current process
|
||||
// not the current working directory
|
||||
//
|
||||
int get_real_executable_path(char* path, size_t max_len) {
|
||||
#ifdef HAVE__PROC_SELF_EXE
|
||||
int ret = readlink("/proc/self/exe", path, max_len);
|
||||
if ( ret >= 0) {
|
||||
path[ret] = '\0'; // readlink does not null terminate
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef _USING_FCGI_
|
||||
FCGI::perror("readlink");
|
||||
#else
|
||||
perror("readlink");
|
||||
#endif
|
||||
return ERR_PROC_PARSE;
|
||||
}
|
||||
#endif
|
||||
return ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ extern bool process_exists(int);
|
|||
|
||||
extern int wait_client_mutex(const char* dir, double timeout);
|
||||
|
||||
extern int get_real_executable_path(char* path, size_t max_len);
|
||||
|
||||
#ifdef GCL_SIMULATOR
|
||||
extern double simtime;
|
||||
#define time(x) ((int)simtime)
|
||||
|
|
Loading…
Reference in New Issue