2#include <Foundation/FoundationInternal.h>
3PL_FOUNDATION_INTERNAL_HEADER
5#if PL_ENABLED(PL_PLATFORM_WINDOWS)
7# include <Foundation/Basics/Platform/Win/IncludeWindows.h>
8# include <Foundation/Configuration/Plugin.h>
9# include <Foundation/IO/OSFile.h>
10# include <Foundation/Logging/Log.h>
11# include <Foundation/Strings/StringBuilder.h>
13using plPluginModule = HMODULE;
15bool plPlugin::PlatformNeedsPluginCopy()
24 ref_sOriginalFile.
Append(
".dll");
33 ref_sOriginalFile.
Append(
".dll");
39 if (uiFileCopyNumber > 0)
42 ref_sCopiedFile.
Append(
".loaded");
48 SetLastError(ERROR_SUCCESS);
50 if (FreeLibrary(ref_pModule) == FALSE)
56 ref_pModule =
nullptr;
63 SetLastError(ERROR_SUCCESS);
65# if PL_ENABLED(PL_PLATFORM_WINDOWS_UWP)
68 ref_pModule = LoadPackagedLibrary(
plStringWChar(relativePath).GetData(), 0);
70 ref_pModule = LoadLibraryW(
plStringWChar(sFileToLoad).GetData());
73 if (ref_pModule ==
nullptr)
75 const DWORD err = GetLastError();
80 plLog::Error(
"Please Note: This means that the plugin exists, but a DLL dependency of the plugin is missing. You probably need to copy 3rd "
81 "party DLLs next to the plugin.");
91# error "This file should not have been included."
static void Error(plLogInterface *pInterface, const plFormatString &string)
An error that needs to be fixed as soon as possible.
Definition Log.cpp:375
static plStringView GetApplicationDirectory()
Returns the path to the directory in which the application binary is located.
Definition OSFile.cpp:331
static bool ExistsFile(plStringView sFile)
Checks whether the given file exists.
Definition OSFile.cpp:229
static const plString GetCurrentWorkingDirectory()
Returns the processes current working directory (CWD).
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
void Append(plUInt32 uiChar)
Appends a single Utf32 character.
Definition StringBuilder_inl.h:94
plResult MakeRelativeTo(plStringView sAbsolutePathToMakeThisRelativeTo)
Converts this path into a relative path to the path with the awesome variable name 'szAbsolutePathToM...
Definition StringBuilder.cpp:1000
void AppendFormat(const plFormatString &string)
Appends a formatted string. Uses '{}' formatting placeholders, see plFormatString for details.
Definition StringBuilder.cpp:1251
void AppendPath(plStringView sPath1, plStringView sPath2={}, plStringView sPath3={}, plStringView sPath4={})
Appends several path pieces. Makes sure they are always properly separated by a slash.
Definition StringBuilder.cpp:866
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A very simple string class that should only be used to temporarily convert text to the OSes native wc...
Definition StringConversion.h:20
Converts a windows HRESULT into an error code and a human-readable error message. Pass in GetLastErro...
Definition FormatStringArgs.h:140
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54