mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
save Utils::getFileName return string value as static in order for it to be accessible outside the function scope
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
e2951c7b8e
commit
be9d569e78
@ -241,7 +241,9 @@ std::string Utils::getParentDirectory(std::string directory)
|
|||||||
std::string Utils::getFileName(std::string filePath)
|
std::string Utils::getFileName(std::string filePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string filename = filePath;
|
/** Declared static to be kept in memory even after this function's scope */
|
||||||
|
static std::string filename;
|
||||||
|
filename = filePath;
|
||||||
|
|
||||||
const size_t last_slash_idx = filePath.rfind(pathSeparator);
|
const size_t last_slash_idx = filePath.rfind(pathSeparator);
|
||||||
if (std::string::npos != last_slash_idx)
|
if (std::string::npos != last_slash_idx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user