This commit is contained in:
Isuru Samarathunga
2025-09-08 19:54:50 +05:30
parent ada777c758
commit 8e2e118dd5
2 changed files with 11 additions and 4 deletions

View File

@ -276,7 +276,11 @@ namespace ia
const auto count = last - first;
res.reserve((count/stride) + 2);
const auto end = start + count + 1;
for(size_type i = start; i < end; i += stride) new (&res.m_data[res.m_count++]) value_type(Base::m_data[i]);
for(size_type i = start; i < end; i += stride)
{
new (&res.m_data[res.m_count++]) value_type(Base::m_data[i]);
if(!Base::m_data[i]) break;
}
res.back() = '\0';
return IA_MOVE(res);
}

View File

@ -121,10 +121,10 @@ namespace ia
if constexpr (includeExtension)
return path.slice(t + 1, path.end());
return path.slice(t + 1, path.begin() + (path.rfind('.') - t) - 1);
return path.slice(t + 1, path.rfind('.'));
}
String ExtractDirectoryFromPath(IN CONST String &path)
template<BOOL includeTrailingSlash> STATIC String ExtractDirectoryFromPath(IN CONST String &path)
{
constexpr char pathDelimiter = '/';
@ -132,7 +132,10 @@ namespace ia
if (t == path.end())
return "./";
return path.slice(0, t + 1);
if CONSTEXPR (includeTrailingSlash)
return path.slice(path.begin(), t + 1);
else
return path.slice(path.begin(), t);
}
private: