TKMM-Team / Tkmm

A mod merger and manager for Tears of the kingdom
https://totkmods.github.io/tkmm/
MIT License
43 stars 5 forks source link

Handle merging of mods without a romfs folder #6

Closed okmika closed 1 month ago

okmika commented 2 months ago

Currently, mods without romfs cause an exception. E.g.:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Mika\\AppData\\Local\\Temp\\360347ed-9b6f-44ae-86b6-91e90b84e92f\\romfs\\RSDB'
[27132] Failed to execute script 'rsdb-merge' due to unhandled exception!
[Error] System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Mika\AppData\Local\Temp\360347ed-9b6f-44ae-86b6-91e90b84e92f\romfs'.
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at TKMM.SarcTool.Core.SarcAssembler.InternalAssemble() in C:\Users\Mika\Sources\Tkmm\lib\TKMM-SARC\TKMM.SarcTool.Core\SarcAssembler.cs:line 103
   at TKMM.SarcTool.Core.SarcAssembler.Assemble() in C:\Users\Mika\Sources\Tkmm\lib\TKMM-SARC\TKMM.SarcTool.Core\SarcAssembler.cs:line 83
   at Tkmm.Core.Components.PackageBuilder.<>c__DisplayClass8_0`1.<CopyContentsInternal>b__1() in C:\Users\Mika\Sources\Tkmm\src\Tkmm.Core\Components\PackageBuilder.cs:line 85
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

SarcTool, RSDB, and any other subtool that operates on romfs should not run in cases where the mod doesn't have a romfs folder. We should just do a straight copy over to the target by priority.

ArchLeaders commented 1 month ago

@okmika this issue is caused by SarcTool as well.

[Error] System.ArgumentException: C:\Users\ArchLeaders\AppData\Roaming\tkmm\mods\7ee08f5d-0508-4331-9885-83bbbb319ae6\romfs does not exist (Parameter 'modFolderPaths')
   at TKMM.SarcTool.Core.SarcMerger..ctor(IEnumerable`1 modFolderPaths, String outputPath, String configPath, String shopsPath) in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\lib\TKMM-SARC\TKMM.SarcTool.Core\SarcMerger.cs:line 65
   at Tkmm.Core.Components.Mergers.SarcMergerShell.Merge(IModItem[] mods, String output) in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm.Core\Components\Mergers\SarcMergerShell.cs:line 11
   at Tkmm.Core.Services.MergerService.MergeAsync(Mod[] mods, String output) in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm.Core\Services\MergerService.cs:line 61
   at Tkmm.Core.Services.MergerService.<>c__DisplayClass4_0.<<Merge>b__2>d.MoveNext() in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm.Core\Services\MergerService.cs:line 46
--- End of stack trace from previous location ---
   at Tkmm.Core.Services.MergerService.Merge(Profile profile, String output) in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm.Core\Services\MergerService.cs:line 44
   at Tkmm.Core.Services.MergerService.Merge() in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm.Core\Services\MergerService.cs:line 19
   at Tkmm.Helpers.MergerOperations.Merge() in F:\Software\Projects\Games\Nintendo\TKMM-Team\Tkmm\src\Tkmm\Helpers\MergerOperations.cs:line 11