singletoning

This commit is contained in:
2025-02-21 18:03:09 +01:00
parent debcc3409e
commit 5f68c6256f
8 changed files with 601 additions and 563 deletions

View File

@@ -1,4 +1,5 @@
#include "utils.h"
#include <filesystem> // Para path
#include <stdlib.h> // Para free, malloc, abs
#include <cmath> // Para round, abs
@@ -586,4 +587,17 @@ std::string toUpper(std::string str)
std::string result(upper);
free(upper);
return result;
}
// Obtiene el nombre de un fichero a partir de una ruta completa
std::string getFileName(const std::string &path)
{
return std::filesystem::path(path).filename().string();
}
// Obtiene la ruta eliminando el nombre del fichero
std::string getPath(const std::string &full_path)
{
std::filesystem::path path(full_path);
return path.parent_path().string();
}