@@ -32,12 +32,13 @@ public ModuleInstaller(GameInstance inst,
3232 IUser user ,
3333 CancellationToken cancelToken = default )
3434 {
35- User = user ;
36- this . cache = cache ;
37- this . config = config ;
38- instance = inst ;
35+ log . DebugFormat ( "Creating ModuleInstaller for {0}" , inst . GameDir ) ;
36+ instance = inst ;
37+ // Make a transaction file manager that uses a temp dir in the instance's CKAN dir
38+ this . cache = cache ;
39+ this . config = config ;
40+ User = user ;
3941 this . cancelToken = cancelToken ;
40- log . DebugFormat ( "Creating ModuleInstaller for {0}" , instance . GameDir ) ;
4142 }
4243
4344 public IUser User { get ; set ; }
@@ -394,7 +395,7 @@ private List<string> InstallModule(CkanModule
394395 // Delete the manually installed DLL transaction-style because we believe we'll be replacing it
395396 var toDelete = instance . ToAbsoluteGameDir ( dll ) ;
396397 log . DebugFormat ( "Deleting manually installed DLL {0}" , toDelete ) ;
397- var txFileMgr = new TxFileManager ( ) ;
398+ var txFileMgr = new TxFileManager ( instance . CkanDir ) ;
398399 txFileMgr . Snapshot ( toDelete ) ;
399400 txFileMgr . Delete ( toDelete ) ;
400401 }
@@ -543,9 +544,9 @@ private static bool StreamsEqual(Stream s1, Stream s2)
543544 /// fails at a later stage.
544545 /// </summary>
545546 /// <param name="files">The files to overwrite</param>
546- private static void DeleteConflictingFiles( IEnumerable < InstallableFile > files )
547+ private void DeleteConflictingFiles( IEnumerable < InstallableFile > files )
547548 {
548- var txFileMgr = new TxFileManager( ) ;
549+ var txFileMgr = new TxFileManager( instance . CkanDir ) ;
549550 foreach ( InstallableFile file in files)
550551 {
551552 log. DebugFormat ( "Trying to delete {0}" , file . destination ) ;
@@ -695,6 +696,16 @@ public static List<InstallableFile> FindInstallableFiles(CkanModule module,
695696
696697 #endregion
697698
699+ private string ? InstallFile ( ZipFile zipfile ,
700+ ZipEntry entry ,
701+ string fullPath ,
702+ bool makeDirs ,
703+ string [ ] candidateDuplicates ,
704+ IProgress < long > ? progress )
705+ => InstallFile ( zipfile , entry , fullPath , makeDirs ,
706+ new TxFileManager ( instance . CkanDir ) ,
707+ candidateDuplicates , progress ) ;
708+
698709 /// <summary>
699710 /// Copy the entry from the opened zipfile to the path specified.
700711 /// </summary>
@@ -707,11 +718,10 @@ public static List<InstallableFile> FindInstallableFiles(CkanModule module,
707718 ZipEntry entry ,
708719 string fullPath ,
709720 bool makeDirs ,
721+ IFileManager txFileMgr ,
710722 string [ ] candidateDuplicates ,
711723 IProgress < long > ? progress )
712724 {
713- var txFileMgr = new TxFileManager( ) ;
714-
715725 if ( entry . IsDirectory )
716726 {
717727 // Skip if we're not making directories for this install.
@@ -918,7 +928,7 @@ private void Uninstall(string identifier,
918928 Registry registry ,
919929 IProgress < long > progress )
920930 {
921- var txFileMgr = new TxFileManager ( ) ;
931+ var txFileMgr = new TxFileManager( instance . CkanDir ) ;
922932
923933 using ( var transaction = CkanTransaction. CreateTransactionScope ( ) )
924934 {
0 commit comments