diff options
-rw-r--r-- | src/textadept.c | 7 | ||||
-rw-r--r-- | src/textadept.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/textadept.c b/src/textadept.c index 6872e872..4d8f90d6 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -78,7 +78,14 @@ int main(int argc, char **argv) { } #ifdef WIN32 +char *textadept_home; int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int) { + char path[260]; + GetModuleFileName(0, path, sizeof(path)); + char *last_slash = strrchr(path, '\\'); + if (last_slash) *last_slash = '\0'; + textadept_home = (char *)path; + // TODO: lpCmdLine contains command line string, pass to Lua gtk_init(0, NULL); l_init(0, NULL, false); diff --git a/src/textadept.h b/src/textadept.h index 395a462f..24c17816 100644 --- a/src/textadept.h +++ b/src/textadept.h @@ -29,7 +29,7 @@ extern lua_State *lua; #ifndef WIN32 static const char *textadept_home = "/usr/share/textadept/"; #else -static const char *textadept_home = "C:\\Program Files\\textadept"; +extern char *textadept_home; #endif static long SS(ScintillaObject *sci, unsigned int msg, unsigned long wParam=0, |