Am Samstag, 17. November 2007 11:39 schrieb Christian Stimming: > "On windows, lookup prefix instead of only bindir.",
Oder als weitere Alternative kann man anstelle GetModuleFileName(NULL), welches den Pfad des *executables* zurückgibt, auch eher die Kombination handle=GetModuleHandle("gwenhywfar") GetModuleFileName(handle, p) nehmen. Dann wäre man eben nicht darauf angewiesen, wo das aufrufende executable liegt (denn das könnte ja entschieden haben, lieber außerhalb des gwen-prefixes zu sein). Stattdessen geht es hier um den Pfad zur gwenhywfar-DLL, und die ist für ihre share- und locale- und plugin-Directories natürlich der bessere Ausgangspunkt. Gruß Christian > > Gruß > > Christian > > > git-svn-id: > https://devel.aqbanking.de/svn/gwenhywfar/branches/[EMAIL PROTECTED] > 70169cfe-8b10-0410-8925-dcb4b91034d8 > --- > src/base/pathmanager.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/src/base/pathmanager.c b/src/base/pathmanager.c > index 1b9bab5..9c6fc02 100644 > --- a/src/base/pathmanager.c > +++ b/src/base/pathmanager.c > @@ -227,6 +227,7 @@ int GWEN_PathManager_AddRelPath(const char *callingLib, > char *p; > GWEN_BUFFER *buf; > > + /* Get the absolute path to the executable, including its name */ > rv=GetModuleFileName(NULL, cwd, sizeof(cwd)-1); > if (rv==0) { > DBG_ERROR(GWEN_LOGDOMAIN, > @@ -235,10 +236,21 @@ int GWEN_PathManager_AddRelPath(const char > *callingLib, return GWEN_ERROR_IO; > } > > + /* Find the last DIRSEP and set it to NULL so that we now have the > + bindir. */ > p=strrchr(cwd, '\\'); > if (p) { > *p=0; > } > + > + /* Find again the last DIRSEP; set it to NULL so that we now have > + the prefix. */ > + p=strrchr(cwd, '\\'); > + if (p) { > + *p=0; > + } > + > + /* And append the given subdirectory to that prefix. */ > buf=GWEN_Buffer_new(0, 256, 0, 1); > GWEN_Buffer_AppendString(buf, cwd); > if (*pathValue!=DIRSEP_C) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Aqbanking-devel mailing list Aqbanking-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aqbanking-devel