mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Check path length on adding them to the cache and log error if a path is too long.
This commit is contained in:
parent
09417bd6c1
commit
5b5a1e2fd8
5 changed files with 10 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ public static unsafe partial class ByteStringFunctions
|
||||||
var path = ( byte* )Marshal.AllocHGlobal( length + 1 );
|
var path = ( byte* )Marshal.AllocHGlobal( length + 1 );
|
||||||
fixed( char* ptr = s )
|
fixed( char* ptr = s )
|
||||||
{
|
{
|
||||||
Encoding.UTF8.GetBytes( ptr, length, path, length + 1 );
|
Encoding.UTF8.GetBytes( ptr, s.Length, path, length + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
path[ length ] = 0;
|
path[ length ] = 0;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public readonly struct Utf8RelPath : IEquatable< Utf8RelPath >, IComparable< Utf
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var substring = s!.Replace( '/', '\\' ).TrimStart('\\');
|
var substring = s.Replace( '/', '\\' ).TrimStart('\\');
|
||||||
if( substring.Length > MaxRelPathLength )
|
if( substring.Length > MaxRelPathLength )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public partial class ModCollection
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginLog.Error( $"Could not add the redirection {path} to {fullPath}, the redirected path is too long." );
|
PluginLog.Error( $"The redirected path is too long to add the redirection\n\t{path}\n\t--> {fullPath}" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -326,8 +326,10 @@ public partial class ModCollection
|
||||||
// Inside the same mod, conflicts are not recorded.
|
// Inside the same mod, conflicts are not recorded.
|
||||||
private void AddFile( Utf8GamePath path, FullPath file, IMod mod )
|
private void AddFile( Utf8GamePath path, FullPath file, IMod mod )
|
||||||
{
|
{
|
||||||
if (!CheckFullPath( path, file ))
|
if( !CheckFullPath( path, file ) )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( ResolvedFiles.TryAdd( path, new ModPath( mod, file ) ) )
|
if( ResolvedFiles.TryAdd( path, new ModPath( mod, file ) ) )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,10 @@ public partial class ModEditWindow
|
||||||
if( ImGuiUtil.DrawDisabledButton( "Apply Changes", Vector2.Zero, tt, !changes ) )
|
if( ImGuiUtil.DrawDisabledButton( "Apply Changes", Vector2.Zero, tt, !changes ) )
|
||||||
{
|
{
|
||||||
var failedFiles = _editor!.ApplyFiles();
|
var failedFiles = _editor!.ApplyFiles();
|
||||||
PluginLog.Information( $"Failed to apply {failedFiles} file redirections to {_editor.CurrentOption.Name}." );
|
if( failedFiles > 0 )
|
||||||
|
{
|
||||||
|
PluginLog.Information( $"Failed to apply {failedFiles} file redirections to {_editor.CurrentOption.FullName}." );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue