Skip to content

Use temp dir in instance for mod file transactions#4462

Merged
HebaruSan merged 4 commits into
KSP-CKAN:masterfrom
HebaruSan:fix/tx-full-on-remove
Nov 25, 2025
Merged

Use temp dir in instance for mod file transactions#4462
HebaruSan merged 4 commits into
KSP-CKAN:masterfrom
HebaruSan:fix/tx-full-on-remove

Conversation

@HebaruSan
Copy link
Copy Markdown
Member

Problem

  1. Have a nearly full C: drive
  2. Switch to a game instance on some other drive
  3. Uninstall a large mod
  4. You get an exception
CKAN.FailedToDeleteFilesKraken: Unable to overwrite or delete files for ParallaxContinued-Terrain-Textures:

GameData\Parallax_StockTerrainTextures\Moho\PluginData\influence.dds
GameData\Parallax_StockTerrainTextures\Moho\PluginData\mid00.dds
GameData\Parallax_StockTerrainTextures\Moho\PluginData\mid01.dds
GameData\Parallax_StockTerrainTextures\Moho\PluginData\steep00.dds
GameData\Parallax_StockTerrainTextures\Moho\PluginData\steep01.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\displacement.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\mid00.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\mid01.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\occlusion.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\steep00.dds
GameData\Parallax_StockTerrainTextures\Mun\PluginData\steep01.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\displacement.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\high00.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\high01.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\influence.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\low00.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\low01.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\mid00.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\mid01.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\occlusion.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\steep00.dds
GameData\Parallax_StockTerrainTextures\Pol\PluginData\steep01.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\displacement.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\high00.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\high01.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\influence.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\mid00.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\mid01.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\occlusion.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\steep00.dds
GameData\Parallax_StockTerrainTextures\Tylo\PluginData\steep01.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\displacement.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\high00.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\high01.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\influence.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\mid00.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\mid01.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\occlusion.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\steep00.dds
GameData\Parallax_StockTerrainTextures\Vall\PluginData\steep01.dds

If the game is still running, close it and try again. Otherwise check the permissions.
   at CKAN.ModuleInstaller.Uninstall(String identifier, HashSet`1& possibleConfigOnlyDirs, Registry registry, IProgress`1 progress)
   at CKAN.ModuleInstaller.UninstallList(IEnumerable`1 mods, HashSet`1& possibleConfigOnlyDirs, RegistryManager registry_manager, Boolean ConfirmPrompt, List`1 installing)
   at CKAN.GUI.Main.InstallMods(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
Error during installation!

Cause

The TxFileManager makes a backup of each file before deletion, so they can be restored in case there is a problem that requires the transaction to be reverted. These backups are made in C:\Users\User\AppData\Local\Temp\CdFileMgr\. If the game is on the same drive, then the free space consumed by the backups is cancelled out by the deletion of the file. But if the game is on another drive, then the game's drive only experiences deletions, while C: just has more net space consumed. This can cause C: to run out of free space before the transaction completes.

Changes

@HebaruSan HebaruSan added Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN labels Nov 25, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Nov 25, 2025

Pull Request Test Coverage Report for Build 19680585887

Details

  • 53 of 58 (91.38%) changed or added relevant lines in 11 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 85.298%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Core/IO/HardLink.cs 0 1 0.0%
Core/IO/InstalledFilesDeduplicator.cs 3 4 75.0%
Core/Net/Net.cs 2 3 66.67%
Core/Net/NetFileCache.cs 9 10 90.0%
Core/Utilities.cs 4 5 80.0%
Files with Coverage Reduction New Missed Lines %
Core/GameInstance.cs 5 87.5%
Totals Coverage Status
Change from base Build 19581664186: -0.03%
Covered Lines: 11966
Relevant Lines: 14212

💛 - Coveralls

@HebaruSan HebaruSan force-pushed the fix/tx-full-on-remove branch from 180f71a to 1d4e11a Compare November 25, 2025 18:36
@HebaruSan HebaruSan force-pushed the fix/tx-full-on-remove branch from 1d4e11a to b2d58dc Compare November 25, 2025 18:47
@HebaruSan HebaruSan merged commit d6d1b81 into KSP-CKAN:master Nov 25, 2025
9 of 12 checks passed
@HebaruSan HebaruSan deleted the fix/tx-full-on-remove branch November 25, 2025 18:56
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Uninstalling mods on alternate drive fails when they're larger than remaining space on primary drive

2 participants