mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Check for too long paths when building cache.
This commit is contained in:
parent
5e9cb77415
commit
df9f791395
2 changed files with 23 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui.Classes;
|
||||
|
|
@ -70,7 +72,24 @@ public partial class ModCollection
|
|||
|
||||
// Force a file to be resolved to a specific path regardless of conflicts.
|
||||
internal void ForceFile( Utf8GamePath path, FullPath fullPath )
|
||||
=> _cache!.ResolvedFiles[ path ] = new ModPath( Mod.ForcedFiles, fullPath );
|
||||
{
|
||||
if( CheckFullPath( path, fullPath ) )
|
||||
{
|
||||
_cache!.ResolvedFiles[ path ] = new ModPath( Mod.ForcedFiles, fullPath );
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
private static bool CheckFullPath( Utf8GamePath path, FullPath fullPath )
|
||||
{
|
||||
if( fullPath.InternalName.Length < Utf8GamePath.MaxGamePathLength )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PluginLog.Error( $"Could not add the redirection {path} to {fullPath}, the redirected path is too long." );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Force a file resolve to be removed.
|
||||
internal void RemoveFile( Utf8GamePath path )
|
||||
|
|
|
|||
|
|
@ -326,6 +326,9 @@ public partial class ModCollection
|
|||
// Inside the same mod, conflicts are not recorded.
|
||||
private void AddFile( Utf8GamePath path, FullPath file, IMod mod )
|
||||
{
|
||||
if (!CheckFullPath( path, file ))
|
||||
return;
|
||||
|
||||
if( ResolvedFiles.TryAdd( path, new ModPath( mod, file ) ) )
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue