mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-12 16:50:43 -05:00
Fix: Copying Logs (!65)
only try to copy logs that exist Co-authored-by: Dev <dev@dev.sp-tarkov.com> Co-authored-by: CWX <cwxdev@outlook.com> Reviewed-on: SPT/Launcher#65 Co-authored-by: waffle.lord <waffle.lord@hotmail.com> Co-committed-by: waffle.lord <waffle.lord@hotmail.com> (cherry picked from commit 3321146d7b04643091319a470969024ead6195cf)
This commit is contained in:
parent
5eb5b2e305
commit
6664061c2b
@ -2,9 +2,7 @@
|
|||||||
using SPT.Launcher.Helpers;
|
using SPT.Launcher.Helpers;
|
||||||
using SPT.Launcher.Models;
|
using SPT.Launcher.Models;
|
||||||
using SPT.Launcher.Models.Launcher;
|
using SPT.Launcher.Models.Launcher;
|
||||||
using SPT.Launcher.ViewModels.Dialogs;
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -50,19 +48,42 @@ namespace SPT.Launcher.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var traceLogs = Directory.GetFiles(Path.Join(LauncherSettingsProvider.Instance.GamePath, "Logs"), $"{DateTime.Now:yyyy.MM.dd}_* traces.log", SearchOption.AllDirectories);
|
var filesToCopy = new List<string> { LogManager.Instance.LogFile };
|
||||||
|
|
||||||
var traceLog = traceLogs.Length > 0 ? traceLogs[0] : "";
|
var serverLog = Path.Join(LauncherSettingsProvider.Instance.GamePath, @"\user\logs",
|
||||||
|
$"server-{DateTime.Now:yyyy-MM-dd}.log");
|
||||||
|
var bepinexLog = Path.Join(LauncherSettingsProvider.Instance.GamePath, @"BepInEx\LogOutput.log");
|
||||||
|
|
||||||
var filesToCopy = new string[]
|
if (AccountManager.SelectedAccount?.id != null)
|
||||||
{
|
{
|
||||||
Path.Join(LauncherSettingsProvider.Instance.GamePath, @"\user\logs", $"server-{DateTime.Now:yyyy-MM-dd}.log"),
|
filesToCopy.Add(Path.Join(LauncherSettingsProvider.Instance.GamePath, @"\user\profiles",
|
||||||
traceLog,
|
$"{AccountManager.SelectedAccount.id}.json"));
|
||||||
Path.Join(LauncherSettingsProvider.Instance.GamePath, @"BepInEx\LogOutput.log"),
|
}
|
||||||
Path.Join(LauncherSettingsProvider.Instance.GamePath, @"\user\profiles", $"{AccountManager.SelectedAccount.id}.json"),
|
|
||||||
LogManager.Instance.LogFile,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if (File.Exists(serverLog))
|
||||||
|
{
|
||||||
|
filesToCopy.Add(serverLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(bepinexLog))
|
||||||
|
{
|
||||||
|
filesToCopy.Add(bepinexLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
var logsPath = Path.Join(LauncherSettingsProvider.Instance.GamePath, "Logs");
|
||||||
|
if (Directory.Exists(logsPath))
|
||||||
|
{
|
||||||
|
var traceLogs = Directory.GetFiles(logsPath, $"{DateTime.Now:yyyy.MM.dd}_* traces.log",
|
||||||
|
SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
var log = traceLogs.Length > 0 ? traceLogs[0] : "";
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(log))
|
||||||
|
{
|
||||||
|
filesToCopy.Add(log);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<IStorageFile> files = new List<IStorageFile>();
|
List<IStorageFile> files = new List<IStorageFile>();
|
||||||
|
|
||||||
foreach (var logPath in filesToCopy)
|
foreach (var logPath in filesToCopy)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user