aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-21 18:53:41 -0400
committerMichael <[email protected]>2017-04-21 18:53:41 -0400
commitdb563c54aedf5e9d96ca70eec08c560ccbc42d8d (patch)
tree4f8b3ba5bb54ee68e217705876e2288075c1026f /ShiftOS_TheReturn
parent25f83c8f191c0e451e2fc88b193d158517396f31 (diff)
downloadshiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.tar.gz
shiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.tar.bz2
shiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.zip
Add ShiftOS->Host Shared Persistence
ShiftOS can now write to the shared folder when saving files/deleting files to the 1:/ drive.
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Paths.cs41
1 files changed, 40 insertions, 1 deletions
diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs
index 2fc55fd..a7d32e7 100644
--- a/ShiftOS_TheReturn/Paths.cs
+++ b/ShiftOS_TheReturn/Paths.cs
@@ -40,7 +40,6 @@ namespace ShiftOS.Engine
public static void Init()
{
Locations = new Dictionary<string, string>();
- Locations.Add("classic", "C:\\ShiftOS");
Locations.Add("root", "0:");
AddPath("root", "system");
@@ -133,6 +132,46 @@ namespace ShiftOS.Engine
mount.Name = "Shared";
Utils.Mount(JsonConvert.SerializeObject(mount));
ScanForDirectories(SharedFolder, 1);
+ Utils.DirectoryCreated += (dir) =>
+ {
+ if (dir.StartsWith("1:/"))
+ {
+ string real = dir.Replace("/", "\\").Replace("1:", SharedFolder);
+ if (!System.IO.Directory.Exists(real))
+ System.IO.Directory.CreateDirectory(real);
+ }
+ };
+
+ Utils.DirectoryDeleted += (dir) =>
+ {
+ if (dir.StartsWith("1:/"))
+ {
+ string real = dir.Replace("/", "\\").Replace("1:", SharedFolder);
+ if (System.IO.Directory.Exists(real))
+ System.IO.Directory.Delete(real, true);
+ }
+ };
+
+ Utils.FileWritten += (dir) =>
+ {
+ if (dir.StartsWith("1:/"))
+ {
+ string real = dir.Replace("/", "\\").Replace("1:", SharedFolder);
+ System.IO.File.WriteAllBytes(real, ReadAllBytes(dir));
+ }
+ };
+
+ Utils.FileDeleted += (dir) =>
+ {
+ if (dir.StartsWith("1:/"))
+ {
+ string real = dir.Replace("/", "\\").Replace("1:", SharedFolder);
+ if (System.IO.File.Exists(real))
+ System.IO.File.Delete(real);
+ }
+ };
+
+
}