salieri: Support read-only mode if archive is already opened (#1807)
This improves shader cache resilience when people opens another program that touch the cache.zip.
This commit is contained in:
parent
19d18662ea
commit
6bc2733c17
5 changed files with 124 additions and 25 deletions
|
@ -496,5 +496,27 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsArchiveReadOnly(string archivePath)
|
||||
{
|
||||
FileInfo info = new FileInfo(archivePath);
|
||||
|
||||
if (!info.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (FileStream stream = info.Open(FileMode.Open, FileAccess.Read, FileShare.None))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue