forked from akanyan/mu3-mods
fix: cache mkdir
I originally left it out because I wanted to avoid unnecessary code duplication. Turns out it wasn't unnecessary.
This commit is contained in:
parent
07ee892b43
commit
032b6864da
@ -12,7 +12,9 @@ class patch_OperationManager: OperationManager {
|
|||||||
~patch_OperationManager() {
|
~patch_OperationManager() {
|
||||||
try {
|
try {
|
||||||
File.WriteAllText(_fileName, MovieIndex.ToString());
|
File.WriteAllText(_fileName, MovieIndex.ToString());
|
||||||
} catch(Exception) { }
|
} catch(Exception ex) {
|
||||||
|
System.Console.WriteLine(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public int MovieIndex {
|
public int MovieIndex {
|
||||||
set {
|
set {
|
||||||
@ -41,7 +43,9 @@ class patch_OperationManager: OperationManager {
|
|||||||
orig_initialize();
|
orig_initialize();
|
||||||
|
|
||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
_fileName = Path.Combine(iniFile.getValue("Extra", "CacheDir", "."), "data_advert_cache.txt");
|
var dir = iniFile.getValue("Extra", "CacheDir", ".");
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
_fileName = Path.Combine(dir, "data_advert_cache.txt");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_movieIndex = Math.Max(0, int.Parse(File.ReadAllText(_fileName)));
|
_movieIndex = Math.Max(0, int.Parse(File.ReadAllText(_fileName)));
|
||||||
|
@ -13,7 +13,9 @@ public class patch_DataStudioManager: DataStudioManager {
|
|||||||
|
|
||||||
private static void initCache() {
|
private static void initCache() {
|
||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
_fileName = Path.Combine(iniFile.getValue("Extra", "CacheDir", "."), "data_cache.bin");
|
var dir = iniFile.getValue("Extra", "CacheDir", ".");
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
_fileName = Path.Combine(dir, "data_cache.bin");
|
||||||
|
|
||||||
if(File.Exists(_fileName)) {
|
if(File.Exists(_fileName)) {
|
||||||
System.Console.WriteLine("Loading data cache...");
|
System.Console.WriteLine("Loading data cache...");
|
||||||
|
Loading…
Reference in New Issue
Block a user