Merge branch 'development' into issues/3202

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-09-01 15:19:32 -07:00
360 changed files with 29993 additions and 30472 deletions
@@ -25,6 +25,7 @@
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/Module/Environment.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/std/chrono/chrono.h>
namespace AZ
{
@@ -33,6 +34,7 @@ namespace AZ
namespace Platform
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
bool AttachDebugger();
bool IsDebuggerPresent();
void HandleExceptions(bool isEnabled);
void DebugBreak();
@@ -141,6 +143,42 @@ namespace AZ
#endif
}
bool
Trace::AttachDebugger()
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
return Platform::AttachDebugger();
#else
return false;
#endif
}
bool
Trace::WaitForDebugger(float timeoutSeconds/*=-1.f*/)
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
using AZStd::chrono::system_clock;
using AZStd::chrono::time_point;
using AZStd::chrono::milliseconds;
milliseconds timeoutMs = milliseconds(aznumeric_cast<long long>(timeoutSeconds * 1000));
system_clock clock;
time_point start = clock.now();
auto hasTimedOut = [&clock, start, timeoutMs]()
{
return timeoutMs.count() >= 0 && (clock.now() - start) >= timeoutMs;
};
while (!AZ::Debug::Trace::IsDebuggerPresent() && !hasTimedOut())
{
AZStd::this_thread::sleep_for(milliseconds(1));
}
return AZ::Debug::Trace::IsDebuggerPresent();
#else
return false;
#endif
}
//=========================================================================
// HandleExceptions
// [8/3/2009]
@@ -49,6 +49,8 @@ namespace AZ
*/
static const char* GetDefaultSystemWindow();
static bool IsDebuggerPresent();
static bool AttachDebugger();
static bool WaitForDebugger(float timeoutSeconds = -1.f);
/// True or false if we want to handle system exceptions.
static void HandleExceptions(bool isEnabled);
+25 -6
View File
@@ -11,6 +11,7 @@
#include <AzCore/std/containers/array.h>
#include <AzCore/std/string/wildcard.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/AzCore_Traits_Platform.h>
// extern instantiations of Path templates to prevent implicit instantiations
namespace AZ::IO
@@ -92,11 +93,23 @@ namespace AZ::IO::Internal
constexpr auto ConsumeRootName(InputIt entryBeginIter, InputIt entryEndIter, const char preferredSeparator)
-> AZStd::enable_if_t<AZStd::Internal::is_forward_iterator_v<InputIt>, InputIt>
{
if (preferredSeparator == '/')
if (preferredSeparator == PosixPathSeparator)
{
// If the preferred separator is forward slash the parser is in posix path
// parsing mode, which doesn't have a root name
// parsing mode, which doesn't have a root name,
// unless we're on a posix platform that uses a custom path root separator
#if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR)
const AZStd::string_view path{ entryBeginIter, entryEndIter };
const auto positionOfPathSeparator = path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR);
if (positionOfPathSeparator == AZStd::string_view::npos)
{
return entryBeginIter;
}
const AZStd::string_view rootName{ path.substr(0, positionOfPathSeparator + 1) };
return AZStd::next(entryBeginIter, rootName.size());
#else
return entryBeginIter;
#endif
}
else
{
@@ -185,13 +198,18 @@ namespace AZ::IO::Internal
template <typename InputIt, typename EndIt, typename = AZStd::enable_if_t<AZStd::Internal::is_input_iterator_v<InputIt>>>
static constexpr bool IsAbsolute(InputIt first, EndIt last, const char preferredSeparator)
{
size_t pathSize = AZStd::distance(first, last);
// If the preferred separator is a forward slash
// than an absolute path is simply one that starts with a forward slash
if (preferredSeparator == '/')
// than an absolute path is simply one that starts with a forward slash,
// unless we're on a posix platform that uses a custom path root separator
if (preferredSeparator == PosixPathSeparator)
{
#if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR)
const AZStd::string_view path{ first, last };
return path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR) != AZStd::string_view::npos;
#else
const size_t pathSize = AZStd::distance(first, last);
return pathSize > 0 && IsSeparator(*first);
#endif
}
else
{
@@ -199,6 +217,7 @@ namespace AZ::IO::Internal
{
// If a windows path ends starts with C:foo it is a root relative path
// A path is absolute root absolute on windows if it starts with <drive_letter><colon><path_separator>
const size_t pathSize = AZStd::distance(first, last);
return pathSize > 2 && Internal::IsSeparator(*AZStd::next(first, 2));
}
@@ -550,7 +550,7 @@ namespace AZ::SettingsRegistryMergeUtils
}
registry.Set(FilePathKey_ProjectUserPath, projectUserPath.Native());
// Set the user directory with the provided path or using project/user as default
// Set the log directory with the provided path or using project/user/log as default
auto projectLogPathKey = FixedValueString::format("%s/project_log_path", BootstrapSettingsRootKey);
AZ::IO::FixedMaxPath projectLogPath;
if (!registry.Get(projectLogPath.Native(), projectLogPathKey))
@@ -640,7 +640,7 @@ namespace AZ::SettingsRegistryMergeUtils
}
#if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
// Setup the cache and user paths when to platform specific locations when running on non-host platforms
// Setup the cache, user, and log paths to platform specific locations when running on non-host platforms
path = engineRoot;
if (AZStd::optional<AZ::IO::FixedMaxPathString> nonHostCacheRoot = Utils::GetDefaultAppRootPath();
nonHostCacheRoot)
@@ -656,13 +656,16 @@ namespace AZ::SettingsRegistryMergeUtils
if (AZStd::optional<AZ::IO::FixedMaxPathString> devWriteStorage = Utils::GetDevWriteStoragePath();
devWriteStorage)
{
registry.Set(FilePathKey_DevWriteStorage, *devWriteStorage);
registry.Set(FilePathKey_ProjectUserPath, *devWriteStorage);
const AZ::IO::FixedMaxPath devWriteStoragePath(*devWriteStorage);
registry.Set(FilePathKey_DevWriteStorage, devWriteStoragePath.LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectUserPath, (devWriteStoragePath / "user").LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectLogPath, (devWriteStoragePath / "user/log").LexicallyNormal().Native());
}
else
{
registry.Set(FilePathKey_DevWriteStorage, path.LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectUserPath, (path / "user").LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectLogPath, (path / "user/log").LexicallyNormal().Native());
}
#endif // AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
}
@@ -19,6 +19,7 @@
#include <AzCore/std/typetraits/is_member_pointer.h>
#include <AzCore/std/typetraits/is_const.h>
#include <AzCore/std/typetraits/remove_cvref.h>
#include <AzCore/std/typetraits/is_volatile.h>
#include <AzCore/std/createdestroy.h>
#define AZSTD_FUNCTION_TARGET_FIX(x)
@@ -591,8 +592,8 @@ namespace AZStd
Internal::function_util::function_buffer type_result;
type_result.type.type = aztypeid(Functor);
type_result.type.const_qualified = is_const<Functor>::value;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
type_result.type.const_qualified = AZStd::is_const<Functor>::value;
type_result.type.volatile_qualified = AZStd::is_volatile<Functor>::value;
vtable->manager(functor, type_result, Internal::function_util::check_functor_type_tag);
return static_cast<Functor*>(type_result.obj_ptr);
}
@@ -608,7 +609,7 @@ namespace AZStd
Internal::function_util::function_buffer type_result;
type_result.type.type = aztypeid(Functor);
type_result.type.const_qualified = true;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
type_result.type.volatile_qualified = AZStd::is_volatile<Functor>::value;
vtable->manager(functor, type_result, Internal::function_util::check_functor_type_tag);
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
// can't do the static_cast that we should do.
@@ -359,7 +359,7 @@ namespace AZStd
{
functor.obj_ref.obj_ptr = (void*)&f.get();
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
functor.obj_ref.is_volatile_qualified = AZStd::is_volatile<FunctionObj>::value;
return true;
}
else
@@ -70,11 +70,11 @@ namespace AZStd
bool try_acquire_until(const chrono::time_point<Clock, Duration>& abs_time)
{
auto timeNow = chrono::system_clock::now();
if (timeNow >= absTime)
if (timeNow >= abs_time)
{
return false; // we timed out already!
}
auto deltaTime = absTime - timeNow;
auto deltaTime = abs_time - timeNow;
auto timeToTry = chrono::duration_cast<chrono::milliseconds>(deltaTime);
return (WaitForSingleObject(m_event, aznumeric_cast<DWORD>(timeToTry.count())) == AZ_WAIT_OBJECT_0);
}