diff options
Diffstat (limited to '7zip/Archive/Common/CodecsPath.cpp')
-rwxr-xr-x | 7zip/Archive/Common/CodecsPath.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/7zip/Archive/Common/CodecsPath.cpp b/7zip/Archive/Common/CodecsPath.cpp new file mode 100755 index 00000000..d2d27ed3 --- /dev/null +++ b/7zip/Archive/Common/CodecsPath.cpp @@ -0,0 +1,34 @@ +// CodecsPath.cpp + +#include "StdAfx.h" +#include "../../../Common/String.h" + +extern HINSTANCE g_hInstance; + +static CSysString GetLibraryPath() +{ + TCHAR fullPath[MAX_PATH + 1]; + ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH); + return fullPath; +} + +static CSysString GetLibraryFolderPrefix() +{ + CSysString path = GetLibraryPath(); + int pos = path.ReverseFind(TEXT('\\')); + return path.Left(pos + 1); +} + +CSysString GetBaseFolderPrefix() +{ + CSysString libPrefix = GetLibraryFolderPrefix(); + CSysString temp = libPrefix; + temp.Delete(temp.Length() - 1); + int pos = temp.ReverseFind(TEXT('\\')); + return temp.Left(pos + 1); +} + +CSysString GetCodecsFolderPrefix() +{ + return GetBaseFolderPrefix() + TEXT("Codecs\\"); +} |