diff options
| author | Michael <[email protected]> | 2017-04-21 18:53:41 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-21 18:53:41 -0400 |
| commit | db563c54aedf5e9d96ca70eec08c560ccbc42d8d (patch) | |
| tree | 4f8b3ba5bb54ee68e217705876e2288075c1026f /ShiftOS_TheReturn/Paths.cs | |
| parent | 25f83c8f191c0e451e2fc88b193d158517396f31 (diff) | |
| download | shiftos_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/Paths.cs')
| -rw-r--r-- | ShiftOS_TheReturn/Paths.cs | 41 |
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); + } + }; + + } |
