RBRCIT icon indicating copy to clipboard operation
RBRCIT copied to clipboard

"Could not find file 'Cars\\.ini' when pressing "Apply" button

Open t3hG04T opened this issue 4 years ago • 1 comments

Hi,

First of all: thank you for developing this super-slick tool. I am refreshing my RBR install after some years of inactivity and I keep getting stunned by the level of community work on the modding scene. Makes me want to get involved in something :).

My problem is:

  1. pick a new car on the "All cars" list
  2. pick a slot on the "Installed cars" list
  3. click the arrow to install the car
  4. click the "Apply" button

The car installs fine (I can launch the game and use it), but there is also an unhandled exception:

System.IO.FileNotFoundException: Could not find file 'Cars\\.ini'.

I tried clearing my Cars.ini (located and read correctly in Cars/Cars.ini), but nothing seems to be helping. Is is something about the filepath (- in the name)? When I click "Continue" the app continues to work fine...

Full stacktrace:

************** Exception Text **************
System.IO.FileNotFoundException: Could not find file 'Cars\\.ini'.
File name: 'Cars\\.ini'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemInfo.set_Attributes(FileAttributes value)
   at System.IO.FileInfo.set_IsReadOnly(Boolean value)
   at RBRCIT.RBRCITModel.ApplyUserSettings()
   at RBRCIT.RBRCITModel.ApplyChanges(Boolean replaceSchoolFiles, Boolean force)
   at RBRCIT.Form1.btApply_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
RBRCIT
    Assembly Version: 1.0.0.0
    Win32 Version: 1.2.0.0
    CodeBase: file:///D:/Games/RBR-Czech/RBRCIT.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ObjectListView
    Assembly Version: 2.9.1.34563
    Win32 Version: 1.2.0.0
    CodeBase: file:///D:/Games/RBR-Czech/RBRCIT.exe
----------------------------------------
System.Deployment
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
SharpCompress
    Assembly Version: 0.11.3.0
    Win32 Version: 1.2.0.0
    CodeBase: file:///D:/Games/RBR-Czech/RBRCIT.exe
----------------------------------------

t3hG04T avatar Jan 16 '21 15:01 t3hG04T

Hum, it appears that the problem was caused by a car not on the AllCars list (I had the Polonez 2000 installed from RBRTM NGP5). After replacing that car exception is no more.

It seems that LoadCurrentCars in the main model does andle such a case (checks for car's ini file existing - ln 280), but ApplyUserSettings does not (line 505, 506): https://github.com/zissakos/RBRCIT/blob/7577dfa92f3d0454175e0cf58c9b9b650c0c2e56/RBRCIT/RBRCITModel.cs#L505-L506

t3hG04T avatar Jan 16 '21 20:01 t3hG04T