Specifying the Parents field is returning a 404 error: file not found
Vivraan opened this issue · comments
Code:
[PostProcessBuild]
public static void OnAndroidBuildFinished(BuildTarget target, string buildPath)
{
if (target == BuildTarget.Android)
{
if (File.Exists(buildPath))
{
var request = UnityGoogleDrive.GoogleDriveFiles.Create(
new UnityGoogleDrive.Data.File
{
Name = Path.GetFileName(buildPath),
Content = File.ReadAllBytes(buildPath),
Parents = new List<string> { "Builds" }
});
request.Fields = new List<string> { "id", "name", "size", "createdTime" };
request.OnDone += responseFile =>
{
if (!request.IsError && request.IsDone)
{
Debug.Log($"Uploaded file: {responseFile.Name} | {responseFile.Size * 10e-6f} MB | Created at {responseFile.CreatedTime:dd.MM.yyyy HH:MM:ss} | ID: {responseFile.Id}");
}
};
request.Send();
}
else
{
Debug.LogError($"{buildPath} does not exist.");
}
}
}
Error:
UnityGoogleDrive: HTTP/1.1 404 Not Found
Google Drive API Error Description: Code '404' Message: 'File not found: Builds.'
- Domain: 'global' Reason: 'notFound' Message: 'File not found: Builds.' LocationType: 'parameter' Location: 'fileId'
UnityEngine.Debug:LogError (object)
UnityGoogleDrive.GoogleDriveRequest`1<UnityGoogleDrive.Data.File>:HandleWebRequestDone (UnityEngine.AsyncOperation) (at Library/PackageCache/com.elringus.unitygoogledrive@fe300dd537/Runtime/GoogleDriveRequest.cs:241)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()
Obviously, a folder named Builds
exists on my Drive root.
How did you fix this
How did you fix this
I believe I had to use the ID of the folder in question, but I essentially closed this because I didn't need a solution.