mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
Sanitize screenshot path
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "../world/Climate.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -198,6 +199,24 @@ uint8_t platform_get_currency_value(const char* currCode)
|
||||
return CURRENCY_POUNDS;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
std::string platform_sanitise_filename(const std::string& path)
|
||||
{
|
||||
auto sanitised = path;
|
||||
|
||||
std::vector<std::string::value_type> prohibited = { '/' };
|
||||
|
||||
std::replace_if(
|
||||
sanitised.begin(), sanitised.end(),
|
||||
[&prohibited](const std::string::value_type& ch) {
|
||||
return std::find(prohibited.begin(), prohibited.end(), ch) != prohibited.end();
|
||||
},
|
||||
'_');
|
||||
|
||||
return sanitised;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __ANDROID__
|
||||
float platform_get_default_scale()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user