mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-12 22:18:34 +00:00
Refactored getOpenSCADPath out to OpenSCADPathFinder
This commit is contained in:
parent
26f4d70876
commit
da558ce75f
@ -48,6 +48,7 @@
|
||||
<Compile Include="Files\IFileInvoker.cs" />
|
||||
<Compile Include="Files\IFileWriter.cs" />
|
||||
<Compile Include="Ids.cs" />
|
||||
<Compile Include="OpenSCADPathFinder.cs" />
|
||||
<Compile Include="Scripting\Binding.cs" />
|
||||
<Compile Include="Scripting\Bindings.cs" />
|
||||
<Compile Include="Scripting\IBindable.cs" />
|
||||
|
||||
30
OSCADSharp/OSCADSharp/OpenSCADPathFinder.cs
Normal file
30
OSCADSharp/OSCADSharp/OpenSCADPathFinder.cs
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -24,23 +24,6 @@ namespace OSCADSharp
|
||||
/// Path to the OpenSCAD executable for file invocation
|
||||
/// (Default value is set the default install directory on Windows)
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user