mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-28 17:34:06 +02:00
Symlinks/junctions in plugin folders can go to hell
This commit is contained in:
parent
cb877b8b23
commit
fd523e552c
@ -84,14 +84,20 @@ public string GetFullPathIfSafe(PluginFolder folder, string relativePath){
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
string folderPathName = new DirectoryInfo(rootFolder).FullName;
|
string folderPathName = new DirectoryInfo(rootFolder).FullName;
|
||||||
DirectoryInfo currentInfo = new DirectoryInfo(fullPath);
|
DirectoryInfo currentInfo = new DirectoryInfo(fullPath); // initially points to the file, which is convenient for the Attributes check below
|
||||||
|
DirectoryInfo parentInfo = currentInfo.Parent;
|
||||||
|
|
||||||
while(currentInfo.Parent != null){
|
while(parentInfo != null){
|
||||||
if (currentInfo.Parent.FullName == folderPathName){
|
if (currentInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)){ // no reason why a plugin should have files/folders with symlinks, junctions, or any other crap
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentInfo.FullName == folderPathName){
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentInfo = currentInfo.Parent;
|
currentInfo = parentInfo;
|
||||||
|
parentInfo = currentInfo.Parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch{
|
catch{
|
||||||
|
Loading…
Reference in New Issue
Block a user