Integrating latest 47acbe8
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
|
||||
#include <AzCore/Android/JNI/Internal/ClassName.h>
|
||||
#include <AzCore/Android/Utils.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Utils
|
||||
@@ -55,6 +58,12 @@ namespace AZ
|
||||
return appRoot ? AZStd::make_optional<AZStd::fixed_string<MaxPathLength>>(appRoot) : AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> GetDevWriteStoragePath()
|
||||
{
|
||||
const char* writeStorage = AZ::Android::Utils::GetAppPublicStoragePath();
|
||||
return writeStorage ? AZStd::make_optional<AZ::IO::FixedMaxPathString>(writeStorage) : AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZStd::fixed_string<MaxPathLength>> ConvertToAbsolutePath(AZStd::string_view path)
|
||||
{
|
||||
AZStd::fixed_string<MaxPathLength> absolutePath;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
|
||||
@@ -169,19 +169,20 @@ namespace Platform
|
||||
{
|
||||
if (s.st_mode & S_IWUSR)
|
||||
{
|
||||
// file is already writeable
|
||||
return true;
|
||||
}
|
||||
return chmod(sourceFileName, permissions | S_IWUSR) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.st_mode & S_IRWXG)
|
||||
if (s.st_mode & S_IWUSR)
|
||||
{
|
||||
return chmod(sourceFileName, permissions & ~(S_IWUSR)) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// file is already writeable
|
||||
// file is already read-only
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
@@ -51,6 +52,11 @@ namespace AZ
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> GetDevWriteStoragePath()
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZStd::fixed_string<MaxPathLength>> ConvertToAbsolutePath(AZStd::string_view path)
|
||||
{
|
||||
AZStd::fixed_string<MaxPathLength> absolutePath;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
|
||||
@@ -48,5 +49,10 @@ namespace AZ
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> GetDevWriteStoragePath()
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,9 @@ namespace AZ::Utils
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> GetDevWriteStoragePath()
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,29 @@ namespace AZ::Utils
|
||||
const char* pathToResources = [[[NSBundle mainBundle] resourcePath] UTF8String];
|
||||
return AZStd::fixed_string<MaxPathLength>::format("%s/assets", pathToResources);
|
||||
}
|
||||
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> GetDevWriteStoragePath()
|
||||
{
|
||||
NSArray* appSupportDirectoryPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
if ([appSupportDirectoryPaths count] == 0)
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
NSString* appSupportDir = static_cast<NSString*>([appSupportDirectoryPaths objectAtIndex:0]);
|
||||
if (!appSupportDir)
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
const char* src = [appSupportDir UTF8String];
|
||||
const size_t srcLen = strlen(src);
|
||||
if (srcLen > MaxPathLength - 1)
|
||||
{
|
||||
return AZStd::nullopt;
|
||||
}
|
||||
|
||||
return AZStd::make_optional<AZ::IO::FixedMaxPathString>(src);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user