mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
A bunch of filesystem fixes.
This commit is contained in:
parent
0b9a48a485
commit
f0af9f1274
4 changed files with 16 additions and 7 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2539675a1bff56088ea7be1f6ad9da2f20115032
|
Subproject commit dd26a7f416106a5bed4ea68c500dfcd5c0818d59
|
||||||
|
|
@ -13,7 +13,7 @@ public readonly struct FullPath : IComparable, IEquatable< FullPath >
|
||||||
public readonly Utf8String InternalName;
|
public readonly Utf8String InternalName;
|
||||||
public readonly ulong Crc64;
|
public readonly ulong Crc64;
|
||||||
|
|
||||||
public static readonly FullPath Empty = new(string.Empty);
|
public static readonly FullPath Empty = new(string.Empty);
|
||||||
|
|
||||||
public FullPath( DirectoryInfo baseDir, Utf8RelPath relPath )
|
public FullPath( DirectoryInfo baseDir, Utf8RelPath relPath )
|
||||||
: this( Path.Combine( baseDir.FullName, relPath.ToString() ) )
|
: this( Path.Combine( baseDir.FullName, relPath.ToString() ) )
|
||||||
|
|
@ -71,9 +71,9 @@ public readonly struct FullPath : IComparable, IEquatable< FullPath >
|
||||||
public int CompareTo( object? obj )
|
public int CompareTo( object? obj )
|
||||||
=> obj switch
|
=> obj switch
|
||||||
{
|
{
|
||||||
FullPath p => InternalName.CompareTo( p.InternalName ),
|
FullPath p => InternalName?.CompareTo( p.InternalName ) ?? -1,
|
||||||
FileInfo f => string.Compare( FullName, f.FullName, StringComparison.InvariantCultureIgnoreCase ),
|
FileInfo f => string.Compare( FullName, f.FullName, StringComparison.InvariantCultureIgnoreCase ),
|
||||||
Utf8String u => InternalName.CompareTo( u ),
|
Utf8String u => InternalName?.CompareTo( u ) ?? -1,
|
||||||
string s => string.Compare( FullName, s, StringComparison.InvariantCultureIgnoreCase ),
|
string s => string.Compare( FullName, s, StringComparison.InvariantCultureIgnoreCase ),
|
||||||
_ => -1,
|
_ => -1,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public sealed class ModFileSystem : FileSystem< Mod >, IDisposable
|
||||||
if( type.HasFlag( MetaChangeType.Name ) && oldName != null )
|
if( type.HasFlag( MetaChangeType.Name ) && oldName != null )
|
||||||
{
|
{
|
||||||
var old = oldName.FixName();
|
var old = oldName.FixName();
|
||||||
if( Find( old, out var child ) )
|
if( Find( old, out var child ) && child is not Folder)
|
||||||
{
|
{
|
||||||
Rename( child, mod.Name.Text );
|
Rename( child, mod.Name.Text );
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +117,7 @@ public sealed class ModFileSystem : FileSystem< Mod >, IDisposable
|
||||||
|
|
||||||
private static (string, bool) SaveMod( Mod mod, string fullPath )
|
private static (string, bool) SaveMod( Mod mod, string fullPath )
|
||||||
{
|
{
|
||||||
var regex = new Regex( $@"^{Regex.Escape( ModToName( mod ) )}( \(\d+\))?" );
|
var regex = new Regex( $@"^{Regex.Escape( ModToName( mod ) )}( \(\d+\))?$" );
|
||||||
// Only save pairs with non-default paths.
|
// Only save pairs with non-default paths.
|
||||||
if( regex.IsMatch( fullPath ) )
|
if( regex.IsMatch( fullPath ) )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.IO;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Components;
|
using Dalamud.Interface.Components;
|
||||||
|
using Dalamud.Logging;
|
||||||
using Dalamud.Memory;
|
using Dalamud.Memory;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
|
|
@ -45,7 +46,14 @@ public partial class ConfigWindow
|
||||||
if( Input.Text( "Mod Path", Input.Path, Input.None, _leaf.FullName(), out var newPath, 256,
|
if( Input.Text( "Mod Path", Input.Path, Input.None, _leaf.FullName(), out var newPath, 256,
|
||||||
_window._inputTextWidth.X ) )
|
_window._inputTextWidth.X ) )
|
||||||
{
|
{
|
||||||
_window._penumbra.ModFileSystem.RenameAndMove( _leaf, newPath );
|
try
|
||||||
|
{
|
||||||
|
_window._penumbra.ModFileSystem.RenameAndMove( _leaf, newPath );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
PluginLog.Warning( e.Message );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Dummy( _window._defaultSpace );
|
ImGui.Dummy( _window._defaultSpace );
|
||||||
|
|
@ -138,6 +146,7 @@ public partial class ConfigWindow
|
||||||
_window.ModEditPopup.ChangeOption( -1, 0 );
|
_window.ModEditPopup.ChangeOption( -1, 0 );
|
||||||
_window.ModEditPopup.IsOpen = true;
|
_window.ModEditPopup.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
fileExists = File.Exists( _mod.DefaultFile );
|
fileExists = File.Exists( _mod.DefaultFile );
|
||||||
tt = fileExists
|
tt = fileExists
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue