Nested OpenSCADPathFinder in OutputSettings

This commit is contained in:
Michael Smith 2016-03-18 20:12:00 -07:00
parent 44b71e0c37
commit ca6bc89206
3 changed files with 31 additions and 40 deletions

View File

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OSCADSharp.IO
{
/// <summary>
/// Known where the default installation locations for OpenSCAD
/// are, and finds the right path for the current environment
/// </summary>
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;
}
}
}

View File

@ -24,5 +24,29 @@ namespace OSCADSharp.IO
/// (Default value is set the default install directory on Windows) /// (Default value is set the default install directory on Windows)
/// </summary> /// </summary>
public static string OpenSCADPath { get; set; } = new OpenSCADPathFinder().GetPath(); public static string OpenSCADPath { get; set; } = new OpenSCADPathFinder().GetPath();
/// <summary>
/// Known where the default installation locations for OpenSCAD
/// are, and finds the right path for the current environment
/// </summary>
private 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;
}
}
} }
} }

View File

@ -42,6 +42,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ColoredObject.cs" />
<Compile Include="DataBinding\BindableBoolean.cs" /> <Compile Include="DataBinding\BindableBoolean.cs" />
<Compile Include="DataBinding\VariableCalculator.cs" /> <Compile Include="DataBinding\VariableCalculator.cs" />
<Compile Include="DataBinding\CompoundVariable.cs" /> <Compile Include="DataBinding\CompoundVariable.cs" />
@ -51,7 +52,6 @@
<Compile Include="IO\IFileInvoker.cs" /> <Compile Include="IO\IFileInvoker.cs" />
<Compile Include="IO\IFileWriter.cs" /> <Compile Include="IO\IFileWriter.cs" />
<Compile Include="Utility\Ids.cs" /> <Compile Include="Utility\Ids.cs" />
<Compile Include="IO\OpenSCADPathFinder.cs" />
<Compile Include="DataBinding\Binding.cs" /> <Compile Include="DataBinding\Binding.cs" />
<Compile Include="DataBinding\Bindings.cs" /> <Compile Include="DataBinding\Bindings.cs" />
<Compile Include="DataBinding\IBindable.cs" /> <Compile Include="DataBinding\IBindable.cs" />
@ -75,7 +75,6 @@
<Compile Include="Solids\Cylinder.cs" /> <Compile Include="Solids\Cylinder.cs" />
<Compile Include="Solids\Sphere.cs" /> <Compile Include="Solids\Sphere.cs" />
<Compile Include="Solids\Text3D.cs" /> <Compile Include="Solids\Text3D.cs" />
<Compile Include="ColoredObject.cs" />
<Compile Include="MinkowskiedObject.cs" /> <Compile Include="MinkowskiedObject.cs" />
<Compile Include="MirroredObject.cs" /> <Compile Include="MirroredObject.cs" />
<Compile Include="ResizedObject.cs" /> <Compile Include="ResizedObject.cs" />
@ -85,7 +84,9 @@
<Compile Include="Spatial\Vector3.cs" /> <Compile Include="Spatial\Vector3.cs" />
<Compile Include="DataBinding\Variables.cs" /> <Compile Include="DataBinding\Variables.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Folder Include="Transforms\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.