mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
assertreadonly the whole directory
This commit is contained in:
parent
779ee43207
commit
597682f4bd
@ -693,6 +693,8 @@ namespace Bloxstrap
|
||||
|
||||
if (dirName != App.State.Prop.Player.VersionGuid && dirName != App.State.Prop.Studio.VersionGuid)
|
||||
{
|
||||
Filesystem.AssertReadOnlyDirectory(dir);
|
||||
|
||||
// check if it's still being used first
|
||||
// we dont want to accidentally delete the files of a running roblox instance
|
||||
if (!TryDeleteRobloxInDirectory(dir))
|
||||
|
@ -31,5 +31,15 @@ namespace Bloxstrap.Utility
|
||||
fileInfo.IsReadOnly = false;
|
||||
App.Logger.WriteLine("Filesystem::AssertReadOnly", $"The following file was set as read-only: {filePath}");
|
||||
}
|
||||
|
||||
internal static void AssertReadOnlyDirectory(string directoryPath)
|
||||
{
|
||||
var directory = new DirectoryInfo(directoryPath) { Attributes = FileAttributes.Normal };
|
||||
|
||||
foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories))
|
||||
info.Attributes = FileAttributes.Normal;
|
||||
|
||||
App.Logger.WriteLine("Filesystem::AssertReadOnlyDirectory", $"The following directory was set as read-only: {directoryPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user