Skip to content

Instantly share code, notes, and snippets.

@chamons

chamons/- Secret

Created July 12, 2017 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamons/6ea530f4e2f20fc15256b30195c875fc to your computer and use it in GitHub Desktop.
Save chamons/6ea530f4e2f20fc15256b30195c875fc to your computer and use it in GitHub Desktop.
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp
using System.Diagnostics;
using System.IO;
foreach (var directory in Directory.EnumerateDirectories ("/System/Library/Frameworks/"))
{
string name = directory.Split(new char[] {'/'}).Last().Split(new char [] {'.'}).First();
string framework = Path.Combine (directory, name);
if (File.Exists (framework))
{
Console.WriteLine (framework);
ProcessStartInfo info = new ProcessStartInfo("/usr/bin/otool", $"-L {framework}")
{
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
};
Process process = Process.Start(info);
string toolOutput = process.StandardOutput.ReadToEnd();
foreach (var line in toolOutput.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{
if (line.Contains("(compatibility"))
{
string depName = line.Split(new string [] {"(compatibility"}, StringSplitOptions.None).First().Replace("\t", "");
Console.WriteLine ("\t" + depName);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment