mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 21:43:06 +01:00
start work on theme manager
This commit is contained in:
@@ -5,6 +5,7 @@ extern "C"
|
||||
#include "../util/util.h"
|
||||
}
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "Memory.hpp"
|
||||
#include "Path.hpp"
|
||||
#include "String.hpp"
|
||||
@@ -17,6 +18,29 @@ namespace Path
|
||||
return safe_strcat_path(buffer, src, bufferSize);
|
||||
}
|
||||
|
||||
utf8 * GetFileNameWithoutExtension(utf8 * buffer, size_t bufferSize, const utf8 * path)
|
||||
{
|
||||
const utf8 * lastDot = nullptr;
|
||||
const utf8 * ch = path;
|
||||
for (; ch != '\0'; ch++)
|
||||
{
|
||||
if (*ch == '.')
|
||||
{
|
||||
lastDot = ch;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastDot == nullptr)
|
||||
{
|
||||
return String::Set(buffer, bufferSize, path);
|
||||
}
|
||||
|
||||
size_t truncatedLength = Math::Min<size_t>(bufferSize - 1, lastDot - path);
|
||||
Memory::Copy(buffer, path, truncatedLength);
|
||||
buffer[truncatedLength] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
utf8 * GetAbsolute(utf8 *buffer, size_t bufferSize, const utf8 * relativePath)
|
||||
{
|
||||
#if __WINDOWS__
|
||||
|
||||
Reference in New Issue
Block a user