WerewolfCustoms / ModsStudio2IssueBoard

Task board and bug tracker for Mods Studio 2 project
11 stars 1 forks source link

Vehicle selection needs a validator #493

Closed WerewolfCustoms closed 5 months ago

WerewolfCustoms commented 5 months ago

Describe the bug

For example in Truck Lightbox template, user can export without selecting the truck. That causes the following issue...

ERROR LOG:
-----------------------------------------------------------------------------
Date : 02/06/2024 22:19:14

System.IO.DirectoryNotFoundException
Message : Could not find a part of the path 'C:\Mods Studio 2\Data\ModProjects\ETS2\Templates\TruckLightbox\vehicle\truck\upgrade\ms2\acc'.
StackTrace :    at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at ModsStudio2Library.Logic.Actions.CopyFile.Execute(Template template) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Library\Logic\Actions\CopyFile.cs:line 63
   at ModsStudio2Library.Models.Template.Build(VariableList enviroment) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Library\Models\Template.cs:line 42
   at ModsStudio2Library.Models.ScsMod.ScsProject.Build(VariableList enviromentVariables) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Library\Models\ScsMod\ScsProject.cs:line 107
   at ModsStudio2Core.Logic.Build.BuildProjectFile(String inputPath, String outputPath, Boolean scsWorkshopUploader) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Core\Logic\Build.cs:line 76
   at ModsStudio2Core.CLI.BuildOptionsHandler.ParseOptions(BuildOptions opts) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Core\CLI\BuildOptions.cs:line 53
   at ModsStudio2Core.Program.<>c.<ProcessInput>b__3_2(BuildOptions opts) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Core\Program.cs:line 105
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
   at ModsStudio2Core.Program.ProcessInput(String[] args) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Core\Program.cs:line 96
   at ModsStudio2Core.Program.Main(String[] args) in D:\a\ModsStudio2\ModsStudio2\ModsStudio2Core\Program.cs:line 77

To Reproduce Steps to reproduce the behavior:

  1. Start a new ETS2 project
  2. Add Truck Lightbox template
  3. Do NOT select any vehicles in the Truck tab
  4. Fill in all other info
  5. Try exporting the mod

Expected behavior User expect exported mod

Screenshots image

Desktop (please complete the following information):

Additional context This might be affecting other templates as well.

Proposed solution Adding a NotEmptyValidator to the truck variable. In this and other templates. Updating the NotEmptyValidator so it can handle this scenario.