linuxgurugamer / GravityTurn

KSP Plugin to automate highly efficient launches
GNU General Public License v3.0
9 stars 8 forks source link

Regression: ArgumentException on completing a launch #14

Open TelluriumCrystal opened 1 year ago

TelluriumCrystal commented 1 year ago

When completing a launch after the latest patch, it looks like GetBaseFilePath() is not returning a valid path now. The following exception occurs:

ArgumentException: Path is empty
  at System.IO.Directory.CreateDirectory (System.String path) [0x00016] in <9577ac7a62ef43179789031239ba8798>:0 
  at GravityTurn.LaunchDB.Save () [0x00016] in <06465023e13e4f5e8e8ca74a35df32ee>:0 
  at GravityTurn.GravityTurner.fly (FlightCtrlState s) [0x00178] in <06465023e13e4f5e8e8ca74a35df32ee>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_FlightCtrlState(FlightCtrlState)
  at Vessel.FeedInputFeed () [0x00033] in <39c0323fb6b449a4aaf3465c00ed3c8d>:0 
  at FlightInputHandler.FixedUpdate () [0x013c3] in <39c0323fb6b449a4aaf3465c00ed3c8d>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
TelluriumCrystal commented 1 year ago

Maybe KSPUtil.SanitizeFilename() needs to be called on the filename alone, not the full path?

TelluriumCrystal commented 1 year ago

Ok yeah, I just read the docs and I'm 95% sure that KSPUtil.SanitizeFilename() is meant to be used with filenames and not full paths. See https://www.kerbalspaceprogram.com/ksp/api/class_k_s_p_util.html#aab5a1b6af14fc52d155e1553c44a0d56