Skip to content

Commit

Permalink
Add missing Nrt_ResourceLoader_Destroy method
Browse files Browse the repository at this point in the history
  • Loading branch information
DynamicField committed Jun 13, 2023
1 parent 32e90cd commit 425cd52
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ extern "C"
{
#endif

NrtResult Nrt_ResourceLoader_Destroy(NrtResourceLoaderHandle resourceLoader);

char* Nrt_ResourceLoader_GetResourcesRootDirectory(NrtResourceLoaderHandle resourceLoader);

NrtResult Nrt_ResourceLoader_SetResourcesLoaderRootDirectory(NrtResourceLoaderHandle resourceLoader,
Expand Down
22 changes: 22 additions & 0 deletions src/NovelRT.Interop/ResourceManagement/NrtResourceLoader.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#include "NovelRT.Interop/ResourceManagement/NrtResourceLoader.h"
#include "../LifetimeExtender.h"
#include <NovelRT.Interop/NrtErrorHandling.h>
#include <NovelRT.Interop/ResourceManagement/NrtResourceManagement.h>
#include <NovelRT/Exceptions/Exceptions.h>
#include <NovelRT/ResourceManagement/ResourceManagement.h>

using namespace NovelRT::ResourceManagement;
using namespace NovelRT::Exceptions;
using namespace NovelRT::Interop;

extern "C"
{
Expand Down Expand Up @@ -232,3 +235,22 @@ extern "C"
return NRT_SUCCESS;
}
}

NrtResult Nrt_ResourceLoader_Destroy(NrtResourceLoaderHandle resourceLoader)
{
if (resourceLoader == nullptr)
{
Nrt_setErrMsgIsNullInstanceProvidedInternal();
return NRT_FAILURE_NULL_INSTANCE_PROVIDED;
}

if (Lifetime::Release(resourceLoader))
{
return NRT_SUCCESS;
}
else
{
Nrt_setErrMsgIsAlreadyDeletedOrRemovedInternal();
return NRT_FAILURE_ALREADY_DELETED_OR_REMOVED;
}
}

0 comments on commit 425cd52

Please sign in to comment.