Skip to content

Silently skip Steam libraries on missing drives#4570

Merged
HebaruSan merged 1 commit into
KSP-CKAN:masterfrom
HebaruSan:fix/steam-bad-lib-drive
Apr 16, 2026
Merged

Silently skip Steam libraries on missing drives#4570
HebaruSan merged 1 commit into
KSP-CKAN:masterfrom
HebaruSan:fix/steam-bad-lib-drive

Conversation

@HebaruSan
Copy link
Copy Markdown
Member

Problem

System.IO.IOException: A device which does not exist was specified.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateFiles(String path, String searchPattern)
   at CKAN.IO.SteamLibrary.LibraryPathGames(KVSerializer acfParser, String appPath)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at CKAN.IO.SteamLibrary..ctor(String libraryPath)
   at CKAN.GameInstanceManager.get_SteamLibrary()
   at CKAN.GUI.Main.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at CKAN.GUI.Main.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Cause

The user had a Steam library on a drive that was no longer available. Those paths were still in the Steam config files, so CKAN was trying to check that drive for KSP instances.

Change

Now if Directory.EnumerateFiles throws an exception, we log.Warn it and ignore that path.

Fixes #4567.

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix Core (ckan.dll) Issues affecting the core part of CKAN labels Apr 15, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 15, 2026

Coverage Report for CI Build 24488350928

Coverage decreased (-0.005%) to 85.544%

Details

  • Coverage decreased (-0.005%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (2 of 6 lines covered, 33.33%).
  • 18 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
Core/IO/SteamLibrary.cs 6 2 33.33%

Coverage Regressions

18 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
Core/Games/KerbalSpaceProgram/GameVersionProviders/KspBuildMap.cs 15 59.41%
Core/Net/NetFileCache.cs 3 90.33%

Coverage Stats

Coverage Status
Relevant Lines: 14225
Covered Lines: 12015
Line Coverage: 84.46%
Relevant Branches: 2163
Covered Branches: 2004
Branch Coverage: 92.65%
Branches in Coverage %: Yes
Coverage Strength: 1.76 hits per line

💛 - Coveralls

@HebaruSan HebaruSan force-pushed the fix/steam-bad-lib-drive branch from a4794fd to 28ea143 Compare April 16, 2026 01:51
@HebaruSan HebaruSan force-pushed the fix/steam-bad-lib-drive branch from 28ea143 to 259aad8 Compare April 16, 2026 02:13
@HebaruSan HebaruSan merged commit 4552dee into KSP-CKAN:master Apr 16, 2026
10 of 12 checks passed
@HebaruSan HebaruSan deleted the fix/steam-bad-lib-drive branch April 16, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN Easy This is easy to fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: System.IO.IOException: A device which does not exist was specified.

2 participants