singletoning
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user