i´m using the VO LogFile class and noticed that the ExecName() func doesn´t work as expected.
oLog := LogFile { "" , FALSE , TRUE }
If no path+file name is given the Logfile init() creates the logfile path+name by calling ExecName(true). Then the extension is removed and "log" added. But because the ExecName() func is part of the XSharp core dll the Logfile points to the GAC dir:
"C:windows...v4.0_2.0.0.9__ed555a0467764586XSharp.Core.log" - :woohoo:
Responsible for that is the core _ExecName() function which uses:
System.Reflection.Assembly.GetExecutingAssembly():Location
As a workaround I created the 2 funcs below and placed them in a DLL. Now, if ExecName2() is called within my exe the created path+file name is the same as with VO. Are there any pitfalls if "System.Reflection.Assembly.GetExecutingAssembly():Location" is simply replaced with "System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName" ?
Code: Select all
// ----------- DLL code ---
STATIC METHOD _ExecName2() AS STRING
RETURN System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
// instead of the currently used:
// RETURN System.Reflection.Assembly.GetExecutingAssembly():Location
// --------
STATIC METHOD ExecName2( lFull AS LOGIC ) AS STRING
LOCAL nPos AS DWORD
LOCAL cPath AS STRING
cPath := _ExecName2()
IF ! lFull
nPos := RAt( "", cPath )
IF nPos != 0
cPath := SubStr2( cPath, nPos + 1 )
ENDIF
ENDIF
RETURN cPath
Karl-Heinz