@@ -1582,22 +1582,19 @@ private string GetBasePersistentDirectory(string basePath, string input)
1582
1582
input = ConverterTool . NormalizePath ( input ) ;
1583
1583
string inStreamingAssetsPath = Path . Combine ( basePath , input ) ;
1584
1584
1585
- int baseStreamingAssetsIndex = input . LastIndexOf ( streamingAssetsName , StringComparison . OrdinalIgnoreCase ) ;
1585
+ int baseStreamingAssetsIndex = input
1586
+ . LastIndexOf ( streamingAssetsName , StringComparison . OrdinalIgnoreCase ) ;
1586
1587
if ( baseStreamingAssetsIndex <= 0 )
1587
1588
{
1588
1589
return inStreamingAssetsPath ;
1589
1590
}
1590
1591
1591
- string inputTrimmed = input . AsSpan ( ) . Slice ( baseStreamingAssetsIndex + streamingAssetsName . Length + 1 )
1592
- . ToString ( ) ;
1592
+ string inputTrimmed = input . AsSpan ( )
1593
+ . Slice ( baseStreamingAssetsIndex + streamingAssetsName . Length + 1 )
1594
+ . ToString ( ) ;
1593
1595
string inPersistentPath = Path . Combine ( basePath , _gamePersistentFolderBasePath , inputTrimmed ) ;
1594
1596
1595
- if ( File . Exists ( inPersistentPath ) )
1596
- {
1597
- return inPersistentPath ;
1598
- }
1599
-
1600
- return inStreamingAssetsPath ;
1597
+ return File . Exists ( inPersistentPath ) ? inPersistentPath : inStreamingAssetsPath ;
1601
1598
}
1602
1599
1603
1600
private async Task FileHdiffPatcherInner ( string patchPath , string sourceBasePath , string destPath , CancellationToken token )
@@ -1728,11 +1725,13 @@ protected virtual async Task ApplyHDiffMap()
1728
1725
1729
1726
bool isSuccess = false ;
1730
1727
1731
- FileInfo sourcePath = new FileInfo ( Path . Combine ( gameDir , entry . SourceFileName ?? "" ) )
1728
+ FileInfo sourcePath = new FileInfo ( GetBasePersistentDirectory ( gameDir , entry . SourceFileName ?? "" ) )
1732
1729
. EnsureNoReadOnly ( out bool isSourceExist ) ;
1730
+ string sourcePathDir = sourcePath . DirectoryName ;
1733
1731
FileInfo patchPath = new FileInfo ( Path . Combine ( gameDir , entry . PatchFileName ?? "" ) )
1734
1732
. EnsureNoReadOnly ( out bool isPatchExist ) ;
1735
- FileInfo targetPath = new FileInfo ( Path . Combine ( gameDir , entry . TargetFileName ?? "" ) )
1733
+ string targetPathBasedOnSource = Path . Combine ( sourcePathDir ?? "" , Path . GetFileName ( entry . TargetFileName ?? "" ) ) ;
1734
+ FileInfo targetPath = new FileInfo ( targetPathBasedOnSource )
1736
1735
. EnsureCreationOfDirectory ( )
1737
1736
. EnsureNoReadOnly ( ) ;
1738
1737
FileInfo targetPathTemp = new FileInfo ( targetPath + "_tmp" )
0 commit comments