aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/path.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-10-18 03:20:06 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-10-18 03:20:06 +0300
commit01e95de886413c252ee1a419ed0a7c41435847e6 (patch)
treee001a71ef743285e75bf01409b33a4b42a37e7da /src/path.cpp
parentcmake: files are per-directory, not per-extension (diff)
downloadwinapi-common-01e95de886413c252ee1a419ed0a7c41435847e6.tar.gz
winapi-common-01e95de886413c252ee1a419ed0a7c41435847e6.zip
Process: add get_exe_path()
Diffstat (limited to '')
-rw-r--r--src/path.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/path.cpp b/src/path.cpp
index 2c2deda..3df5918 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -16,8 +16,11 @@ namespace winapi {
namespace {
std::wstring do_canonicalize(const std::wstring& path) {
+ BOOST_STATIC_CONSTEXPR std::size_t init_buffer_size = MAX_PATH;
+ static_assert(init_buffer_size > 0, "init_buffer_size must be positive");
+
std::vector<wchar_t> buffer;
- buffer.resize(MAX_PATH);
+ buffer.resize(init_buffer_size);
while (true) {
const auto nch = ::GetFullPathNameW(path.c_str(), buffer.size(), buffer.data(), NULL);