mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 16:27:47 +01:00
Allow Penumbra to use long and arbitrary UTF8 paths.
This commit is contained in:
parent
68a787d125
commit
08519396a0
7 changed files with 195 additions and 31 deletions
|
|
@ -156,9 +156,7 @@ public partial class Mod
|
|||
private static DirectoryInfo NewOptionDirectory( DirectoryInfo baseDir, string optionName )
|
||||
=> new(Path.Combine( baseDir.FullName, ReplaceBadXivSymbols( optionName ) ));
|
||||
|
||||
|
||||
// XIV can not deal with non-ascii symbols in a path,
|
||||
// and the path must obviously be valid itself.
|
||||
// Normalize for nicer names, and remove invalid symbols or invalid paths.
|
||||
public static string ReplaceBadXivSymbols( string s, string replacement = "_" )
|
||||
{
|
||||
if( s == "." )
|
||||
|
|
@ -174,7 +172,7 @@ public partial class Mod
|
|||
StringBuilder sb = new(s.Length);
|
||||
foreach( var c in s.Normalize( NormalizationForm.FormKC ) )
|
||||
{
|
||||
if( c.IsInvalidAscii() || c.IsInvalidInPath() )
|
||||
if( c.IsInvalidInPath() )
|
||||
{
|
||||
sb.Append( replacement );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue