Gems/Atom builds

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-07-30 18:53:50 -07:00
parent 41ad6d7b7a
commit f665f572f3
24 changed files with 159 additions and 146 deletions
-1
View File
@@ -10,7 +10,6 @@
#pragma once
#include "CryThread.h"
#include "StringUtils.h"
#include "../Include/SandboxAPI.h"
#include <QString>
#include <QFileInfo>
+18 -19
View File
@@ -15,24 +15,20 @@
#include <AzToolsFramework/API/EditorAssetSystemAPI.h> // for ebus events
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzCore/std/string/conversions.h>
#include <QRegularExpression>
namespace
{
string g_currentModName; // folder name only!
}
namespace Path
{
//////////////////////////////////////////////////////////////////////////
void SplitPath(const QString& rstrFullPathFilename, QString& rstrDriveLetter, QString& rstrDirectory, QString& rstrFilename, QString& rstrExtension)
{
string strFullPathString(rstrFullPathFilename.toUtf8().data());
string strDriveLetter;
string strDirectory;
string strFilename;
string strExtension;
AZStd::string strFullPathString(rstrFullPathFilename.toUtf8().data());
AZStd::string strDriveLetter;
AZStd::string strDirectory;
AZStd::string strFilename;
AZStd::string strExtension;
char* szPath((char*)strFullPathString.c_str());
char* pchLastPosition(szPath);
@@ -81,16 +77,16 @@ namespace Path
strFilename.assign(pchLastPosition, pchCurrentPosition);
}
rstrDriveLetter = strDriveLetter;
rstrDirectory = strDirectory;
rstrFilename = strFilename;
rstrExtension = strExtension;
rstrDriveLetter = strDriveLetter.c_str();
rstrDirectory = strDirectory.c_str();
rstrFilename = strFilename.c_str();
rstrExtension = strExtension.c_str();
}
//////////////////////////////////////////////////////////////////////////
void GetDirectoryQueue(const QString& rstrSourceDirectory, QStringList& rcstrDirectoryTree)
{
string strCurrentDirectoryName;
string strSourceDirectory(rstrSourceDirectory.toUtf8().data());
AZStd::string strCurrentDirectoryName;
AZStd::string strSourceDirectory(rstrSourceDirectory.toUtf8().data());
const char* szSourceDirectory(strSourceDirectory.c_str());
const char* pchCurrentPosition(szSourceDirectory);
const char* pchLastPosition(szSourceDirectory);
@@ -207,7 +203,9 @@ namespace Path
bool IsFolder(const char* pPath)
{
DWORD attrs = GetFileAttributes(pPath);
AZStd::wstring pPathW;
AZStd::to_wstring(pPathW, pPath);
DWORD attrs = GetFileAttributes(pPathW.c_str());
if (attrs == FILE_ATTRIBUTE_DIRECTORY)
{
@@ -255,16 +253,17 @@ namespace Path
/// Get the data folder
AZStd::string GetEditingGameDataFolder()
{
static AZStd::string s_currentModName;
// query the editor root. The bus exists in case we want tools to be able to override this.
if (g_currentModName.empty())
if (s_currentModName.empty())
{
return GetGameAssetsFolder();
}
AZStd::string str(GetGameAssetsFolder());
str += "Mods\\";
str += g_currentModName;
str += s_currentModName;
return str;
}
+8 -8
View File
@@ -93,7 +93,7 @@ namespace Path
#endif
file = path_buffer;
}
inline void Split(const string& filepath, string& path, string& file)
inline void Split(const AZStd::string& filepath, AZStd::string& path, AZStd::string& file)
{
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
@@ -101,7 +101,7 @@ namespace Path
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
#ifdef AZ_COMPILER_MSVC
_splitpath_s(filepath, drive, AZ_ARRAY_SIZE(drive), dir, AZ_ARRAY_SIZE(dir), 0, 0, 0, 0);
_splitpath_s(filepath.c_str(), drive, AZ_ARRAY_SIZE(drive), dir, AZ_ARRAY_SIZE(dir), 0, 0, 0, 0);
_makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), drive, dir, 0, 0);
path = path_buffer;
_makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), 0, 0, fname, ext);
@@ -137,7 +137,7 @@ namespace Path
filename = fname;
fext = ext;
}
inline void Split(const string& filepath, string& path, string& filename, string& fext)
inline void Split(const AZStd::string& filepath, AZStd::string& path, AZStd::string& filename, AZStd::string& fext)
{
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
@@ -145,7 +145,7 @@ namespace Path
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
#ifdef AZ_COMPILER_MSVC
_splitpath_s(filepath, drive, AZ_ARRAY_SIZE(drive), dir, AZ_ARRAY_SIZE(dir), fname, AZ_ARRAY_SIZE(fname), ext, AZ_ARRAY_SIZE(ext));
_splitpath_s(filepath.c_str(), drive, AZ_ARRAY_SIZE(drive), dir, AZ_ARRAY_SIZE(dir), fname, AZ_ARRAY_SIZE(fname), ext, AZ_ARRAY_SIZE(ext));
_makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), drive, dir, 0, 0);
#else
_splitpath(filepath, drive, dir, fname, ext);
@@ -271,7 +271,7 @@ namespace Path
}
template<size_t size>
inline void AddBackslash(AZstd::fixed_string<size>* path)
inline void AddBackslash(AZStd::fixed_string<size>* path)
{
if (path->empty())
{
@@ -284,7 +284,7 @@ namespace Path
}
template<size_t size>
inline void AddSlash(AZstd::fixed_string<size>* path)
inline void AddSlash(AZStd::fixed_string<size>* path)
{
if (path->empty())
{
@@ -357,7 +357,7 @@ namespace Path
{
return CaselessPaths(GetRelativePath(path, true));
}
inline string FullPathToGamePath(const char* path)
inline AZStd::string FullPathToGamePath(const char* path)
{
return CaselessPaths(GetRelativePath(path, true)).toUtf8().data();
}
@@ -394,7 +394,7 @@ namespace Path
inline QString GetAudioLocalizationFolder(bool returnAbsolutePath)
{
// Omit the trailing slash!
QString sLocalizationFolder(QString(PathUtil::GetLocalizationFolder()).left(static_cast<int>(PathUtil::GetLocalizationFolder().size()) - 1));
QString sLocalizationFolder(QString(PathUtil::GetLocalizationFolder().c_str()).left(static_cast<int>(PathUtil::GetLocalizationFolder().size()) - 1));
if (!sLocalizationFolder.isEmpty())
{