diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj index 9208137..3756410 100644 --- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj +++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj @@ -48,6 +48,7 @@ + diff --git a/OSCADSharp/OSCADSharp/OpenSCADPathFinder.cs b/OSCADSharp/OSCADSharp/OpenSCADPathFinder.cs new file mode 100644 index 0000000..7d5918d --- /dev/null +++ b/OSCADSharp/OSCADSharp/OpenSCADPathFinder.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp +{ + internal class OpenSCADPathFinder + { + private string[] possibleFilePaths = new string[] + { + @"C:\Program Files (x86)\OpenSCAD\openscad.exe", + @"C:\Program Files\OpenSCAD\openscad.exe" + }; + + internal string GetPath() + { + foreach (string path in possibleFilePaths) + { + if (File.Exists(path)) + return path; + } + + return null; + } + + } +} diff --git a/OSCADSharp/OSCADSharp/Settings.cs b/OSCADSharp/OSCADSharp/Settings.cs index 61a9772..32f45ba 100644 --- a/OSCADSharp/OSCADSharp/Settings.cs +++ b/OSCADSharp/OSCADSharp/Settings.cs @@ -24,23 +24,6 @@ namespace OSCADSharp /// Path to the OpenSCAD executable for file invocation /// (Default value is set the default install directory on Windows) /// - public static string OpenSCADPath = getOpenSCADPath(); - - private static string getOpenSCADPath() - { - string[] possibleFilePaths = new string[] - { - @"C:\Program Files (x86)\OpenSCAD\openscad.exe", - @"C:\Program Files\OpenSCAD\openscad.exe" - }; - - foreach (string path in possibleFilePaths) - { - if (File.Exists(path)) - return path; - } - - return null; - } + public static string OpenSCADPath = new OpenSCADPathFinder().GetPath(); } }