mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-02-02 06:17:34 +00:00
Bidirectional Persistence!
This commit is contained in:
parent
db563c54ae
commit
1e74f09670
1 changed files with 14 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue