Dependency checking

This commit is contained in:
2023-07-12 11:21:53 -04:00
parent bbb7f5e26c
commit 574d128cb6
3 changed files with 80 additions and 11 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dexif_Installer {
class Helper {
// https://stackoverflow.com/a/3856090/4708786
public static bool ExistsOnPath(string fileName) {
return GetFullPath(fileName) != null;
}
public static string GetFullPath(string fileName) {
if (File.Exists(fileName)) {
return Path.GetFullPath(fileName);
}
var values = Environment.GetEnvironmentVariable("PATH");
foreach (var path in values.Split(Path.PathSeparator)) {
var fullPath = Path.Combine(path, fileName);
if (File.Exists(fullPath)) {
return fullPath;
}
}
return null;
}
}
}