From 114141b56e02857fa749cc130f16a2d6cc4c35f5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Apr 2017 08:54:38 -0400 Subject: Add FS delete functions --- ShiftOS_TheReturn/Paths.cs | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'ShiftOS_TheReturn') diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index e756da7..a84271b 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -135,41 +135,57 @@ namespace ShiftOS.Engine //This event-based system allows us to sync the ramdisk from ShiftOS to the host OS. Utils.DirectoryCreated += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (!System.IO.Directory.Exists(real)) - System.IO.Directory.CreateDirectory(real); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (!System.IO.Directory.Exists(real)) + System.IO.Directory.CreateDirectory(real); + } } + catch { } }; Utils.DirectoryDeleted += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (System.IO.Directory.Exists(real)) - System.IO.Directory.Delete(real, true); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (System.IO.Directory.Exists(real)) + System.IO.Directory.Delete(real, true); + } } + catch { } }; Utils.FileWritten += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - System.IO.File.WriteAllBytes(real, ReadAllBytes(dir)); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + System.IO.File.WriteAllBytes(real, ReadAllBytes(dir)); + } } + catch { } }; Utils.FileDeleted += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (System.IO.File.Exists(real)) - System.IO.File.Delete(real); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (System.IO.File.Exists(real)) + System.IO.File.Delete(real); + } } + catch { } }; //This thread will sync the ramdisk from the host OS to ShiftOS. -- cgit v1.2.3