Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes for 3.3.3 #1021

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 46 additions & 26 deletions Assets/Plugins/Android/Core/AndroidFileIOHelper.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,65 @@
/*
* Copyright (c) 2024 PlayEveryWare
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
* Copyright (c) 2024 PlayEveryWare
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace PlayEveryWare.EpicOnlineServices
{
using System;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;

public class AndroidFileIOHelper
{
public static async Task<string> ReadAllText(string filePath)
public static bool FileExists(string filePath)
{
using UnityWebRequest request = UnityWebRequest.Get(filePath);
request.timeout = 2; //seconds till timeout
UnityWebRequestAsyncOperation operation = request.SendWebRequest();
request.timeout = 2;
request.SendWebRequest();
while (!request.isDone) { }

bool exists = (request.result == UnityWebRequest.Result.Success);

while (!operation.isDone)
if (!exists)
{
await Task.Yield();
Debug.LogError($"AndroidFileIOHelper says that \"{filePath}\" does not exist.");
}

return exists;
}

public static string ReadAllText(string filePath)
{
using UnityWebRequest request = UnityWebRequest.Get(filePath);
request.timeout = 2; //seconds till timeout
request.SendWebRequest();

while (!request.isDone) { }

return ProcessRequest(filePath, request);
}

private static string ProcessRequest(string filePath, UnityWebRequest request)
{
string text = null;

switch (request.result)
Expand Down Expand Up @@ -72,4 +92,4 @@ public static async Task<string> ReadAllText(string filePath)
return text;
}
}
}
}
3 changes: 2 additions & 1 deletion Assets/Plugins/Source/Editor/Platforms/iOS/IOSBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#if !EOS_DISABLE
namespace PlayEveryWare.EpicOnlineServices.Editor.Build
{
using EpicOnlineServices.Utility;
using System.IO;
using UnityEditor;
using UnityEditor.Build.Reporting;
Expand Down Expand Up @@ -60,7 +61,7 @@ public override void PostBuild(BuildReport report)

PBXProject proj = new();

proj.ReadFromString(FileUtility.ReadAllText(projPath));
proj.ReadFromString(FileSystemUtility.ReadAllText(projPath));

string targetGUID = proj.GetUnityMainTargetGuid();
string unityTargetGUID = proj.GetUnityFrameworkTargetGuid();
Expand Down
Loading