Merge pull request 'use continue instead of break' (#102) from waffle.lord/Installer:fix/bak-file-filtering into master

Reviewed-on: SPT/Installer#102
This commit is contained in:
IsWaffle 2024-07-10 21:29:43 +00:00
commit 0a0615813c
3 changed files with 23 additions and 6 deletions

View File

@ -61,7 +61,7 @@ public static class FileHelper
if (currentFileRelativePath.EndsWith(".bak")) if (currentFileRelativePath.EndsWith(".bak"))
{ {
Log.Debug($"EXCLUDING BAK FILE :: {currentFileRelativePath}"); Log.Debug($"EXCLUDING BAK FILE :: {currentFileRelativePath}");
break; continue;
} }
fileCopies.Add(new CopyInfo(file.FullName, file.FullName.Replace(sourceDir.FullName, targetDir.FullName))); fileCopies.Add(new CopyInfo(file.FullName, file.FullName.Replace(sourceDir.FullName, targetDir.FullName)));

View File

@ -10,8 +10,8 @@
<PackageIcon>icon.ico</PackageIcon> <PackageIcon>icon.ico</PackageIcon>
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon> <ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
<Configurations>Debug;Release;TEST</Configurations> <Configurations>Debug;Release;TEST</Configurations>
<AssemblyVersion>2.88</AssemblyVersion> <AssemblyVersion>2.89</AssemblyVersion>
<FileVersion>2.88</FileVersion> <FileVersion>2.89</FileVersion>
<Company>SPT</Company> <Company>SPT</Company>
</PropertyGroup> </PropertyGroup>

View File

@ -1,4 +1,5 @@
using System.Diagnostics; using System.Collections.Generic;
using System.Diagnostics;
using Avalonia; using Avalonia;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
@ -93,15 +94,26 @@ public class MessageViewModel : ViewModelBase
} }
var dataObject = new DataObject(); var dataObject = new DataObject();
var logFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(data.DebugMode ? App.LogDebugPath : App.LogPath);
var filesToCopy = new List<IStorageFile>();
var logFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(data.DebugMode ? App.LogDebugPath : App.LogPath);
var patcherLogFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(Path.Join(data.TargetInstallPath, "patcher.log"));
if (logFile == null) if (logFile == null)
{ {
ClipCommandText = "Could not get log file :("; ClipCommandText = "Could not get log file :(";
return; return;
} }
dataObject.Set(DataFormats.Files, new[] {logFile}); filesToCopy.Add(logFile);
if (patcherLogFile != null)
{
filesToCopy.Add(patcherLogFile);
}
dataObject.Set(DataFormats.Files, filesToCopy.ToArray());
await desktop.MainWindow.Clipboard.SetDataObjectAsync(dataObject); await desktop.MainWindow.Clipboard.SetDataObjectAsync(dataObject);
ClipCommandText = "Copied!"; ClipCommandText = "Copied!";
@ -190,6 +202,11 @@ public class MessageViewModel : ViewModelBase
} }
File.Copy(App.LogPath, Path.Join(data.TargetInstallPath, "spt-installer.log"), true); File.Copy(App.LogPath, Path.Join(data.TargetInstallPath, "spt-installer.log"), true);
if (data.DebugMode)
{
File.Copy(App.LogDebugPath, Path.Join(data.TargetInstallPath, "spt-installer-debug.log"), true);
}
} }
catch (Exception ex) catch (Exception ex)
{ {