diff options
author | 2010-04-02 14:10:24 -0400 | |
---|---|---|
committer | 2010-04-02 14:10:24 -0400 | |
commit | 4b9cf4b46f218be1cd8b2576c64b1273852f6758 (patch) | |
tree | 592340f1f24ee018d5e21660146650fca4fee226 /src/textadept.c | |
parent | 3aa5dbfd321c31d05006f4aecabd73fdcd8e5f7b (diff) | |
download | textadept-4b9cf4b46f218be1cd8b2576c64b1273852f6758.tar.gz textadept-4b9cf4b46f218be1cd8b2576c64b1273852f6758.zip |
Added BSD support.
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/textadept.c b/src/textadept.c index 171e1730..4f8333a5 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -9,6 +9,9 @@ #include "ige-mac-menu.h" #define CFURL_TO_STR(u) \ CFStringGetCStringPtr(CFURLCopyFileSystemPath(u, kCFURLPOSIXPathStyle), 0) +#elif __BSD__ +#include <sys/types.h> +#include <sys/sysctl.h> #endif #define gbool gboolean @@ -59,7 +62,7 @@ static gbool c_keypress(GtkWidget *, GdkEventKey *, gpointer); * @param argv The array of command line params. */ int main(int argc, char **argv) { -#if !(__WIN32__ || MAC) +#if !(__WIN32__ || MAC || __BSD__) textadept_home = g_file_read_link("/proc/self/exe", NULL); #elif MAC CFBundleRef bundle = CFBundleGetMainBundle(); @@ -71,6 +74,11 @@ int main(int argc, char **argv) { char *user_home = g_strconcat(getenv("HOME"), "/.gtkrc-2.0", NULL); gtk_rc_parse(user_home); g_free(user_home); +#elif __BSD__ + textadept_home = malloc(FILENAME_MAX); + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; + size_t cb = FILENAME_MAX; + sysctl(mib, 4, textadept_home, &cb, NULL, 0); #endif char *last_slash = strrchr(textadept_home, G_DIR_SEPARATOR); if (last_slash) *last_slash = '\0'; |