First review code changes (identation and cosmetic changes)

This commit is contained in:
Fernando Casas Schössow 2022-11-21 22:27:15 +01:00 committed by trzy
parent d11efb8553
commit 317f8bacde
3 changed files with 67 additions and 51 deletions

View file

@ -32,9 +32,9 @@
namespace FileSystemPath
{
enum fsPathType { Analysis, Config, Log, NVRAM, Saves, Screenshots }; // Filesystem path types
enum PathType { Analysis, Config, Log, NVRAM, Saves, Screenshots }; // Filesystem path types
bool PathExists(std::string fileSystemPath); // Checks if a directory exists (returns true if exists, false if it doesn't)
std::string GetPath(fsPathType pathType); // Generates a path to be used by Supermodel files
std::string GetPath(PathType pathType); // Generates a path to be used by Supermodel files
}

View file

@ -45,7 +45,7 @@ namespace FileSystemPath
}
// Generates a path to be used by Supermodel files
std::string GetPath(fsPathType pathType)
std::string GetPath(PathType pathType)
{
std::string finalPath = "";
std::string homePath = "";
@ -96,10 +96,12 @@ namespace FileSystemPath
else
{
// If directory doesn't exist, create it
if (!FileSystemPath::PathExists(strPathType)) mkdir(strPathType.c_str(), 0775);
if (!FileSystemPath::PathExists(strPathType))
{
mkdir(strPathType.c_str(), 0775);
}
finalPath = strPathType;
}
}
// Check if $HOME/.supermodel exists
else if (FileSystemPath::PathExists(Util::Format() << homePath << "/.supermodel"))
@ -120,25 +122,39 @@ namespace FileSystemPath
{
finalPath = Util::Format() << homePath << "/.config/supermodel";
// If directory doesn't exist, create it
if (!FileSystemPath::PathExists(finalPath)) mkdir(finalPath.c_str(), 0775);
if (!FileSystemPath::PathExists(finalPath))
{
mkdir(finalPath.c_str(), 0775);
}
// If directory doesn't exist, create it
finalPath = Util::Format() << homePath << "/.config/supermodel/Config";
if (!FileSystemPath::PathExists(finalPath)) mkdir(finalPath.c_str(), 0775);
if (!FileSystemPath::PathExists(finalPath))
{
mkdir(finalPath.c_str(), 0775);
}
}
else
{
finalPath = Util::Format() << homePath << "/.local/share/supermodel";
// If directory doesn't exist, create it
if (!FileSystemPath::PathExists(finalPath)) mkdir(finalPath.c_str(), 0775);
if (!FileSystemPath::PathExists(finalPath))
{
mkdir(finalPath.c_str(), 0775);
}
// If directory doesn't exist, create it
finalPath = Util::Format() << homePath << "/.local/share/supermodel/" << strPathType;
if (!FileSystemPath::PathExists(finalPath)) mkdir(finalPath.c_str(), 0775);
if (!FileSystemPath::PathExists(finalPath))
{
mkdir(finalPath.c_str(), 0775);
}
}
}
if (finalPath != "") finalPath = Util::Format() << finalPath << "/";
if (finalPath != "")
{
finalPath = Util::Format() << finalPath << "/";
}
return finalPath;

View file

@ -25,7 +25,7 @@
namespace FileSystemPath
{
// Generates a path to be used by Supermodel files
std::string GetPath(fsPathType pathType)
std::string GetPath(PathType pathType)
{
switch (pathType)
{