mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
fix RO file erros with VFS
This commit is contained in:
parent
53d7c5c83a
commit
021fc58052
@ -18,6 +18,7 @@
|
|||||||
* Treat .fomod files as archives
|
* Treat .fomod files as archives
|
||||||
* Include WABBAJACK_INCLUDE files before including patches
|
* Include WABBAJACK_INCLUDE files before including patches
|
||||||
* Ignore .bin and .refcache files (DynDOLOD temp files)
|
* Ignore .bin and .refcache files (DynDOLOD temp files)
|
||||||
|
* Shell out to cmd.exe for VFS cleaning should fix "ReadOnlyFile" errors once and for all
|
||||||
|
|
||||||
#### Version 0.9.1 - 9/5/2019
|
#### Version 0.9.1 - 9/5/2019
|
||||||
* Fixed a bug where having only one profile selected would result in no profiles being selected
|
* Fixed a bug where having only one profile selected would result in no profiles being selected
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using Compression.BSA;
|
using Compression.BSA;
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -28,11 +30,17 @@ namespace VFS
|
|||||||
RootFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
RootFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
|
||||||
_stagedRoot = Path.Combine(RootFolder, "vfs_staged_files");
|
_stagedRoot = Path.Combine(RootFolder, "vfs_staged_files");
|
||||||
Utils.OnQueue(() =>
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Clean()
|
||||||
{
|
{
|
||||||
if (Directory.Exists(_stagedRoot))
|
if (Directory.Exists(_stagedRoot))
|
||||||
|
{
|
||||||
|
Directory.EnumerateDirectories(_stagedRoot)
|
||||||
|
.PMap(f => DeleteDirectory(f));
|
||||||
DeleteDirectory(_stagedRoot);
|
DeleteDirectory(_stagedRoot);
|
||||||
});
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(_stagedRoot);
|
Directory.CreateDirectory(_stagedRoot);
|
||||||
}
|
}
|
||||||
@ -47,28 +55,41 @@ namespace VFS
|
|||||||
|
|
||||||
public VirtualFile this[string path] => Lookup(path);
|
public VirtualFile this[string path] => Lookup(path);
|
||||||
|
|
||||||
private static void DeleteDirectory(string path, bool recursive = true)
|
private static void DeleteDirectory(string path)
|
||||||
{
|
{
|
||||||
if (recursive)
|
var info = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
var subfolders = Directory.GetDirectories(path);
|
FileName = "cmd.exe",
|
||||||
foreach (var s in subfolders) DeleteDirectory(s, recursive);
|
Arguments = $"/c del /f /q /s \"{path}\" && rmdir /q /s \"{path}\" ",
|
||||||
}
|
RedirectStandardError = true,
|
||||||
|
RedirectStandardInput = true,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
};
|
||||||
|
|
||||||
var files = Directory.GetFiles(path);
|
var p = new Process
|
||||||
foreach (var f in files)
|
{
|
||||||
|
StartInfo = info
|
||||||
|
};
|
||||||
|
|
||||||
|
p.Start();
|
||||||
|
ChildProcessTracker.AddProcess(p);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var attr = File.GetAttributes(f);
|
p.PriorityClass = ProcessPriorityClass.BelowNormal;
|
||||||
if ((attr & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
|
||||||
File.SetAttributes(f, attr ^ FileAttributes.ReadOnly);
|
|
||||||
File.Delete(f);
|
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.Delete(path, true);
|
while (!p.HasExited)
|
||||||
|
{
|
||||||
|
var line = p.StandardOutput.ReadLine();
|
||||||
|
if (line == null) break;
|
||||||
|
Utils.Status(line);
|
||||||
|
}
|
||||||
|
p.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadFromDisk()
|
private void LoadFromDisk()
|
||||||
|
@ -103,6 +103,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public void Compile()
|
public void Compile()
|
||||||
{
|
{
|
||||||
|
VirtualFileSystem.Clean();
|
||||||
Info("Looking for other profiles");
|
Info("Looking for other profiles");
|
||||||
var other_profiles_path = Path.Combine(MO2ProfileDir, "otherprofiles.txt");
|
var other_profiles_path = Path.Combine(MO2ProfileDir, "otherprofiles.txt");
|
||||||
SelectedProfiles = new HashSet<string>();
|
SelectedProfiles = new HashSet<string>();
|
||||||
|
@ -78,6 +78,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public void Install()
|
public void Install()
|
||||||
{
|
{
|
||||||
|
VirtualFileSystem.Clean();
|
||||||
Directory.CreateDirectory(Outputfolder);
|
Directory.CreateDirectory(Outputfolder);
|
||||||
Directory.CreateDirectory(DownloadFolder);
|
Directory.CreateDirectory(DownloadFolder);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user