From 20c058f7190c73835894ecf426b3762d4d26e30f Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 28 Jan 2018 03:43:20 -0700 Subject: [PATCH] Added support for newer versions of PIA where the ruby files are put under src\bin instead of just src. --- PIA_manager/Program.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/PIA_manager/Program.cs b/PIA_manager/Program.cs index a71ee79..7be0e33 100644 --- a/PIA_manager/Program.cs +++ b/PIA_manager/Program.cs @@ -107,10 +107,22 @@ private static void FindPiaFiles() Console.WriteLine($"Ruby files directory: {rubyFilesDir}"); rubyExecutable = Path.Combine(rubyFilesDir, "bin", "rubyw.exe"); - rubySourceFile = Path.Combine(rubyFilesDir, "src", "pia_manager.rb"); - if (!File.Exists(rubyExecutable)) throw new FileNotFoundException("Could not find ruby executable", rubyExecutable); - if (!File.Exists(rubySourceFile)) throw new FileNotFoundException("Could not find pia_manager ruby file", rubySourceFile); + + var rubySourceFileOld = Path.Combine(rubyFilesDir, "src", "pia_manager.rb"); + var rubySourceFileNew = Path.Combine(rubyFilesDir, "src", "bin", "pia_manager.rb"); + if (File.Exists(rubySourceFileOld)) + { + rubySourceFile = rubySourceFileOld; + } + else if (File.Exists(rubySourceFileNew)) + { + rubySourceFile = rubySourceFileNew; + } + else + { + throw new FileNotFoundException("Could not find pia_manager ruby file", rubySourceFile); + } } static bool DirContainsPiaFiles(string searchDir)