Skip to content

Commit 9c82d6e

Browse files
committed
[iOS] Fixed configuration file cache between builds.
[Windows] Added check that the project is located on the same drive as the engine.
1 parent 052dc07 commit 9c82d6e

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

Source/CleverAdsSolutions/CleverAdsSolutions.Build.cs

+23-4
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@ private static void LocalProcessOutput(object Sender, DataReceivedEventArgs Args
186186
public virtual void ApplyToModule(CleverAdsSolutions Module, ReadOnlyTargetRules Target)
187187
{
188188
// module.ModuleDirectory = Plugins/CleverAdsSolutions/Source/CleverAdsSolutions
189+
string ModuleDirectory = Module.ModuleDirectory;
189190
PlatformName = Target.Platform.ToString();
190191
LogDebug(PlatformName + " Plugin build configuration");
191-
NativeDir = new DirectoryReference(Path.Combine(Module.ModuleDirectory, "..", "ThirdParty", PlatformName));
192+
NativeDir = new DirectoryReference(Path.Combine(ModuleDirectory, "..", "ThirdParty", PlatformName));
192193
ShippingMode = Target.Configuration == UnrealTargetConfiguration.Shipping;
193194

194195
string UPLFileName = "CAS_UPL_" + PlatformName + ".xml";
195-
string UPLFilePath = Path.Combine(Module.ModuleDirectory, UPLFileName);
196+
string UPLFilePath = Path.Combine(ModuleDirectory, UPLFileName);
196197
if (!File.Exists(UPLFilePath))
197198
LostRequiredFile(UPLFilePath);
198199

@@ -201,11 +202,29 @@ public virtual void ApplyToModule(CleverAdsSolutions Module, ReadOnlyTargetRules
201202
LostRequiredFile(MediationListFile.FullName);
202203

203204
Module.PublicDefinitions.Add("WITH_CAS=1");
204-
string ModuleDirectoryRelative = Utils.MakePathRelativeTo(Module.ModuleDirectory, Target.RelativeEnginePath);
205+
206+
string ModuleDirectoryRelative = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
205207
string ModuleDirectoryRelativeUPLFilePath = Path.Combine(ModuleDirectoryRelative, UPLFileName);
206208
LogDebug("Apply UPL: " + ModuleDirectoryRelativeUPLFilePath);
207209
Module.AdditionalPropertiesForReceipt.Add(PlatformName + "Plugin", ModuleDirectoryRelativeUPLFilePath);
208210

211+
// When building an application on a Windows machine,
212+
// it is crucial to ensure that your project folder is located on the same drive
213+
// as the Unreal Engine installation directory. (e.g., both on C: or both on D:)
214+
if (ModuleDirectory[1] == ':' && ModuleDirectory[0] != Module.EngineDirectory[0])
215+
{
216+
string ErrorMessage = "The project folder msut be located on the same drive (" +
217+
Module.EngineDirectory[0] + ":) as the Unreal Engine installation directory: " +
218+
Module.EngineDirectory;
219+
if (ShippingMode)
220+
{
221+
CancelBuild(ErrorMessage);
222+
}
223+
else
224+
{
225+
LogWarning(ErrorMessage);
226+
}
227+
}
209228

210229
JsonObject ConfigJson = JsonObject.Read(MediationListFile);
211230
Version = ConfigJson.GetStringField("version");
@@ -491,7 +510,7 @@ public override void ApplyToModule(CleverAdsSolutions Module, ReadOnlyTargetRule
491510
if (FileReference.Exists(CacheConfigFile))
492511
{
493512
var ConfigFilePathForBuild = CacheConfigFile.ChangeExtension(null);
494-
FileUtils.ForceMoveFile(CacheConfigFile, ConfigFilePathForBuild);
513+
FileReference.Copy(CacheConfigFile, ConfigFilePathForBuild, true);
495514
Module.AdditionalBundleResources.Add(new BundleResource(ConfigFilePathForBuild.FullName));
496515
}
497516

0 commit comments

Comments
 (0)