aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 00:17:29 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 00:17:29 -0400
commit14cc9fe52b4cc75553dd907882594467b16c5bf1 (patch)
tree6956b21cad4ef2e8ff684d30e59aadc86166ca89 /src
parent504360888bbe3e5bad4f203ae083de69f8b7e218 (diff)
downloadtextadept-14cc9fe52b4cc75553dd907882594467b16c5bf1.tar.gz
textadept-14cc9fe52b4cc75553dd907882594467b16c5bf1.zip
Use textadept.exe path as textadept_home instead of C:\Program Files\textadept.
Diffstat (limited to 'src')
-rw-r--r--src/textadept.c7
-rw-r--r--src/textadept.h2
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,