File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
libs/openFrameworks/utils Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1860,15 +1860,19 @@ fs::path ofFilePath::getCurrentExePath(){
1860
1860
}
1861
1861
return path;
1862
1862
#elif defined(TARGET_WIN32)
1863
- vector<char > executablePath (MAX_PATH);
1864
- DWORD result = ::GetModuleFileNameA (nullptr , &executablePath[0 ], static_cast <DWORD>(executablePath.size ()));
1863
+ wchar_t filename[MAX_PATH];
1864
+ DWORD result = ::GetModuleFileName (
1865
+ nullptr , // retrieve path of current process .EXE
1866
+ filename,
1867
+ _countof (filename)
1868
+ );
1865
1869
if (result == 0 ) {
1866
- ofLogError (" ofFilePath" ) << " getCurrentExePath(): couldn't get path, GetModuleFileNameA failed" ;
1867
- } else {
1868
- return string (executablePath.begin (), executablePath.begin () + result);
1870
+ // Error
1871
+ ofLogError (" ofFilePath" ) << " getCurrentExePath(): couldn't get path, GetModuleFileName failed" ;
1869
1872
}
1873
+ return filename;
1870
1874
#endif
1871
- return " " ;
1875
+ return {} ;
1872
1876
}
1873
1877
1874
1878
You can’t perform that action at this time.
0 commit comments