diff options
Diffstat (limited to 'CPP/7zip/FileManager/ProgramLocation.cpp')
-rwxr-xr-x | CPP/7zip/FileManager/ProgramLocation.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/CPP/7zip/FileManager/ProgramLocation.cpp b/CPP/7zip/FileManager/ProgramLocation.cpp new file mode 100755 index 00000000..88c18d5e --- /dev/null +++ b/CPP/7zip/FileManager/ProgramLocation.cpp @@ -0,0 +1,24 @@ +// ProgramLocation.h + +#include "StdAfx.h" + +#include "ProgramLocation.h" + +#include "Windows/FileName.h" +#include "Windows/DLL.h" + +using namespace NWindows; + +extern HINSTANCE g_hInstance; + +bool GetProgramFolderPath(UString &folder) +{ + if (!NDLL::MyGetModuleFileName(g_hInstance, folder)) + return false; + int pos = folder.ReverseFind(L'\\'); + if (pos < 0) + return false; + folder = folder.Left(pos + 1); + return true; +} + |