File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,13 @@ class directory {
2626 auto len = GetModuleFileName (NULL , temp, MAX_PATH);
2727 if (0 == len)
2828 throw std::runtime_error (moon::format (" module_path error: %u" , GetLastError ()));
29- std::string res (temp, len);
30- fs::path p = fs::path (res);
29+ fs::path p = fs::path (std::string_view (temp, len));
3130#elif TARGET_PLATFORM == PLATFORM_MAC
3231 char temp[1024 ];
33- uint32_t bufferSize = sizeof (temp);
34- if (_NSGetExecutablePath (temp, &bufferSize ) != 0 )
32+ uint32_t len = sizeof (temp);
33+ if (_NSGetExecutablePath (temp, &len ) != 0 )
3534 throw std::runtime_error (" module_path error: buffer too small" );
36- size_t actual_len = strlen (temp);
37- std::string res (temp, actual_len);
38- fs::path p = fs::canonical (fs::path (res));
35+ fs::path p = fs::canonical (fs::path (temp));
3936#else
4037 char temp[1024 ];
4138 auto len = readlink (" /proc/self/exe" , temp, sizeof (temp) - 1 );
You can’t perform that action at this time.
0 commit comments