mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-11 13:30:02 -04:00
47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
$NetBSD: patch-ae,v 1.2 2008/02/28 20:59:03 drochner Exp $
|
|
|
|
--- src/lib/FilePath.cpp.orig 2008-02-25 11:38:32.000000000 +0100
|
|
+++ src/lib/FilePath.cpp
|
|
@@ -23,6 +23,8 @@
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
+#include "../config.h"
|
|
+
|
|
#define PATH_DELIMITERS "\\/"
|
|
|
|
std::string GetTempDirectory()
|
|
@@ -106,31 +108,7 @@ std::string GetAppPath()
|
|
::GetModuleFileName(NULL, buf, 511);
|
|
path = buf;
|
|
#else
|
|
- //code adapted from public domain code by Nicolai Haehnle <prefect_@gmx.net>
|
|
- char linkname[64]; /* /proc/<pid>/exe */
|
|
- int ret;
|
|
-
|
|
- /* Get our PID and build the name of the link in /proc */
|
|
- pid_t pid = getpid();
|
|
-
|
|
- if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", pid) < 0)
|
|
- return path; //error
|
|
-
|
|
- /* Now read the symbolic link */
|
|
- char buffer[2048];
|
|
- ret = readlink(linkname, buffer, sizeof(buffer));
|
|
-
|
|
- /* In case of an error, leave the handling up to the caller */
|
|
- if (ret == -1)
|
|
- return path;
|
|
-
|
|
- /* Report insufficient buffer size */
|
|
- if (ret >= (int)sizeof(buffer))
|
|
- return path;
|
|
-
|
|
- buffer[ret] = '\0'; //terminate the buffer
|
|
-
|
|
- path = buffer;
|
|
+ path = INSTALL_PREFIX "/bin/notecase";
|
|
#endif
|
|
found = true;
|
|
}
|