Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ProgramLocation.cpp « FileManager « UI « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ce2d178e59a7a1c6e248101d867f073757271eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ProgramLocation.cpp

#include "StdAfx.h"

#include "../../../../C/Types.h"

#include "ProgramLocation.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(WCHAR_PATH_SEPARATOR);
  if (pos < 0)
    return false;
  folder = folder.Left(pos + 1);
  return true;
}