aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-21 18:58:58 -0400
committerMichael <[email protected]>2017-04-21 18:58:58 -0400
commit1e74f09670a89d8fdf51215aa7a275c335e80211 (patch)
tree6ff957d996ea8c897c1e658a97505a5884b869a2 /ShiftOS_TheReturn
parentdb563c54aedf5e9d96ca70eec08c560ccbc42d8d (diff)
downloadshiftos_thereturn-1e74f09670a89d8fdf51215aa7a275c335e80211.tar.gz
shiftos_thereturn-1e74f09670a89d8fdf51215aa7a275c335e80211.tar.bz2
shiftos_thereturn-1e74f09670a89d8fdf51215aa7a275c335e80211.zip
Bidirectional Persistence!
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Paths.cs16
1 files changed, 14 insertions, 2 deletions
diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs
index a7d32e7..e756da7 100644
--- a/ShiftOS_TheReturn/Paths.cs
+++ b/ShiftOS_TheReturn/Paths.cs
@@ -132,6 +132,7 @@ namespace ShiftOS.Engine
mount.Name = "Shared";
Utils.Mount(JsonConvert.SerializeObject(mount));
ScanForDirectories(SharedFolder, 1);
+ //This event-based system allows us to sync the ramdisk from ShiftOS to the host OS.
Utils.DirectoryCreated += (dir) =>
{
if (dir.StartsWith("1:/"))
@@ -171,7 +172,17 @@ namespace ShiftOS.Engine
}
};
-
+ //This thread will sync the ramdisk from the host OS to ShiftOS.
+ var t = new Thread(() =>
+ {
+ while (!SaveSystem.ShuttingDown)
+ {
+ Thread.Sleep(15000);
+ ScanForDirectories(SharedFolder, 1);
+ }
+ });
+ t.IsBackground = true;
+ t.Start();
}
@@ -186,7 +197,8 @@ namespace ShiftOS.Engine
foreach (var directory in System.IO.Directory.GetDirectories(folder))
{
string mfsDir = directory.Replace(SharedFolder, $"{mount}:").Replace("\\", "/");
- CreateDirectory(mfsDir);
+ if(!DirectoryExists(mfsDir))
+ CreateDirectory(mfsDir);
ScanForDirectories(directory, mount);
}
}