Skip to content

Commit

Permalink
Merge pull request #1442 from ergoxiv/hotfix/file-rename-dupl-extensions
Browse files Browse the repository at this point in the history
Fixed file rename causing duplicate file extensions
  • Loading branch information
StoiaCode authored Feb 2, 2025
2 parents 2907669 + 26b392b commit f546e2d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Anamnesis/Files/FileBrowserView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

namespace Anamnesis.GUI.Views;

using Anamnesis.Files;
using Anamnesis.GUI.Dialogs;
using Anamnesis.Services;
using Anamnesis.Styles.Drawers;
using PropertyChanged;
using Serilog;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand All @@ -14,12 +20,6 @@ namespace Anamnesis.GUI.Views;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Anamnesis.Files;
using Anamnesis.GUI.Dialogs;
using Anamnesis.Services;
using Anamnesis.Styles.Drawers;
using PropertyChanged;
using Serilog;
using XivToolsWpf;

public abstract class FileBrowserDrawer : SelectorDrawer<FileBrowserView.EntryWrapper>
Expand Down Expand Up @@ -504,7 +504,7 @@ private async void OnDeleteClick(object sender, RoutedEventArgs e)
return;

var entry = this.Selected.Entry;
if(entry is DirectoryInfo directory)
if (entry is DirectoryInfo directory)
{
directory.Delete(true);
}
Expand Down Expand Up @@ -672,7 +672,9 @@ public string? Rename
if (this.Entry is FileInfo file)
{
string? extension = Path.GetExtension(this.Entry.FullName);
newPath += extension;
if (!newPath.EndsWith(extension, StringComparison.OrdinalIgnoreCase))
newPath += extension;

file.MoveTo(newPath);
}
else if (this.Entry is DirectoryInfo dir)
Expand Down

0 comments on commit f546e2d

Please sign in to comment.