@@ -2340,8 +2340,9 @@ void IGFD::FileManager::SetCurrentDir(const std::string& vPath) {
23402340 std::wstring fpath (numchar, 0 );
23412341 GetFullPathNameW (wpath.c_str (), numchar, (wchar_t *)fpath.data (), nullptr );
23422342 std::string real_path = IGFD::Utils::UTF8Encode (fpath);
2343- while (real_path.back () == ' \0 ' ) // for fix issue we can have with std::string concatenation.. if there is a \0 at end
2343+ while (real_path.back () == ' \0 ' ) { // for fix issue we can have with std::string concatenation.. if there is a \0 at end
23442344 real_path = real_path.substr (0 , real_path.size () - 1U );
2345+ }
23452346 if (!real_path.empty ())
23462347#elif defined(_IGFD_UNIX_) // _IGFD_UNIX_ is _IGFD_WIN_ or APPLE
23472348 char real_path[PATH_MAX];
@@ -2350,7 +2351,7 @@ void IGFD::FileManager::SetCurrentDir(const std::string& vPath) {
23502351#endif // _IGFD_WIN_
23512352 {
23522353 m_CurrentPath = std::move (real_path);
2353- if (m_CurrentPath[m_CurrentPath.size () - 1 ] == PATH_SEP) {
2354+ if (m_CurrentPath. size () > 1 && m_CurrentPath [m_CurrentPath.size () - 1 ] == PATH_SEP) {
23542355 m_CurrentPath = m_CurrentPath.substr (0 , m_CurrentPath.size () - 1 );
23552356 }
23562357 IGFD::Utils::SetBuffer (inputPathBuffer, MAX_PATH_BUFFER_SIZE, m_CurrentPath);
@@ -2415,7 +2416,9 @@ bool IGFD::FileManager::SetPathOnParentDirectoryIfAny() {
24152416}
24162417
24172418std::string IGFD::FileManager::GetCurrentPath () {
2418- if (m_CurrentPath.empty ()) m_CurrentPath = " ." ;
2419+ if (m_CurrentPath.empty ()) {
2420+ m_CurrentPath = " ." ;
2421+ }
24192422 return m_CurrentPath;
24202423}
24212424
0 commit comments