Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CrossPlatform][ProcessFactory] fix log file creation #1728

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

ZeeWanderer
Copy link
Contributor

@ZeeWanderer ZeeWanderer commented Jul 7, 2024

Current formatting results in file name containing : symbol and so file creation fails. Basically it results in something like

PenDriverPro.exe-2024-07-08T02:05:41.stdout.log

And since the path isn't validated in any way it fails with

00:00:21.847 [ERROR] (NexusMods.App.Program) Encountered an exception published to an object with an unobserved ThrownExceptions property|System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\██████\AppData\Local\NexusMods.App\Logs\ProcessLogs\PenDriverPro.exe-2024-07-08T02:05:41.stdout.log'
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at NexusMods.Paths.BaseFileSystem.OpenFile(AbsolutePath path, FileMode mode, FileAccess access, FileShare share)
   at NexusMods.Paths.AbsolutePath.Open(FileMode mode, FileAccess access, FileShare share)
   at NexusMods.CrossPlatform.Process.ProcessFactory.ExecuteAsync(Command command, Boolean logProcessOutput, CancellationToken cancellationToken) in E:\Projects\NexusMods.App_fork\src\NexusMods.CrossPlatform\Process\ProcessFactory.cs:line 78
   at NexusMods.Abstractions.Games.RunGameTool`1.RunCommand(CancellationToken cancellationToken, AbsolutePath program) in E:\Projects\NexusMods.App_fork\src\Abstractions\NexusMods.Abstractions.Games\RunGameTool.cs:line 123
   at NexusMods.Abstractions.Games.RunGameTool`1.Execute(ReadOnly loadout, CancellationToken cancellationToken) in E:\Projects\NexusMods.App_fork\src\Abstractions\NexusMods.Abstractions.Games\RunGameTool.cs:line 94
   at NexusMods.DataModel.ToolManager.RunTool(ITool tool, ReadOnly loadout, CancellationToken token) in E:\Projects\NexusMods.App_fork\src\NexusMods.DataModel\ToolManager.cs:line 57
   at NexusMods.App.UI.LeftMenu.Items.LaunchButtonViewModel.<>c__DisplayClass19_0.<<LaunchGame>b__0>d.MoveNext() in E:\Projects\NexusMods.App_fork\src\NexusMods.App.UI\LeftMenu\Items\LaunchButtonViewModel.cs:line 44
--- End of stack trace from previous location ---
   at NexusMods.App.UI.LeftMenu.Items.LaunchButtonViewModel.LaunchGame(CancellationToken token) in E:\Projects\NexusMods.App_fork\src\NexusMods.App.UI\LeftMenu\Items\LaunchButtonViewModel.cs:line 42

@ZeeWanderer ZeeWanderer changed the title [NexusMods.CrossPlatform][ProcessFactory] fix log file creation [CrossPlatform][ProcessFactory] fix log file creation Jul 7, 2024
@erri120 erri120 added the os-windows This affects Windows related code. label Jul 8, 2024
@erri120 erri120 merged commit cb6c79f into Nexus-Mods:main Jul 9, 2024
11 checks passed
@ZeeWanderer ZeeWanderer deleted the fixlogfile branch July 10, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os-windows This affects Windows related code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants