mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-08-20 08:59:21 +08:00
Fix for RPF Explorer not showing empty folders
This commit is contained in:
parent
06accfc17e
commit
5bce17785a
@ -557,7 +557,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
string fullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
string fullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
|
|
||||||
string[] allfiles = Directory.GetFiles(GTAFolder.CurrentGTAFolder, "*", SearchOption.AllDirectories);
|
string[] allpaths = Directory.GetFileSystemEntries(GTAFolder.CurrentGTAFolder, "*", SearchOption.AllDirectories);
|
||||||
|
|
||||||
Dictionary<string, MainTreeFolder> nodes = new Dictionary<string, MainTreeFolder>();
|
Dictionary<string, MainTreeFolder> nodes = new Dictionary<string, MainTreeFolder>();
|
||||||
|
|
||||||
@ -569,16 +569,18 @@ namespace CodeWalker
|
|||||||
|
|
||||||
UpdateStatus("Scanning...");
|
UpdateStatus("Scanning...");
|
||||||
|
|
||||||
foreach (var filepath in allfiles)
|
foreach (var path in allpaths)
|
||||||
{
|
{
|
||||||
var relpath = filepath.Replace(fullPath, "");
|
var relpath = path.Replace(fullPath, "");
|
||||||
var filepathl = filepath.ToLowerInvariant();
|
var filepathl = path.ToLowerInvariant();
|
||||||
|
|
||||||
|
var isFile = File.Exists(path); //could be a folder
|
||||||
|
|
||||||
UpdateStatus("Scanning " + relpath + "...");
|
UpdateStatus("Scanning " + relpath + "...");
|
||||||
|
|
||||||
MainTreeFolder parentnode = null, prevnode = null, node = null;
|
MainTreeFolder parentnode = null, prevnode = null, node = null;
|
||||||
var prevnodepath = "";
|
var prevnodepath = "";
|
||||||
var idx = relpath.LastIndexOf('\\');
|
var idx = isFile ? relpath.LastIndexOf('\\') : relpath.Length;
|
||||||
while (idx > 0) //create the folder tree nodes and build up the hierarchy
|
while (idx > 0) //create the folder tree nodes and build up the hierarchy
|
||||||
{
|
{
|
||||||
var parentpath = relpath.Substring(0, idx);
|
var parentpath = relpath.Substring(0, idx);
|
||||||
@ -608,13 +610,15 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFile)
|
||||||
|
{
|
||||||
if (filepathl.EndsWith(".rpf")) //add RPF nodes
|
if (filepathl.EndsWith(".rpf")) //add RPF nodes
|
||||||
{
|
{
|
||||||
RpfFile rpf = new RpfFile(filepath, relpath);
|
RpfFile rpf = new RpfFile(path, relpath);
|
||||||
|
|
||||||
rpf.ScanStructure(UpdateStatus, UpdateErrorLog);
|
rpf.ScanStructure(UpdateStatus, UpdateErrorLog);
|
||||||
|
|
||||||
node = CreateRpfTreeFolder(rpf, relpath, filepath);
|
node = CreateRpfTreeFolder(rpf, relpath, path);
|
||||||
|
|
||||||
RecurseMainTreeViewRPF(node, allRpfs);
|
RecurseMainTreeViewRPF(node, allRpfs);
|
||||||
|
|
||||||
@ -631,11 +635,12 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
if (parentnode != null)
|
if (parentnode != null)
|
||||||
{
|
{
|
||||||
parentnode.AddFile(filepath);
|
parentnode.AddFile(path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
root.AddFile(filepath);
|
root.AddFile(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user