mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
Nested OpenSCADPathFinder in OutputSettings
This commit is contained in:
parent
44b71e0c37
commit
ca6bc89206
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -7,12 +7,12 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.IO
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings for OpenSCAD scripts
|
||||
/// </summary>
|
||||
public static class OutputSettings
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Code-gen header
|
||||
/// </summary>
|
||||
@ -23,6 +23,30 @@ namespace OSCADSharp.IO
|
||||
/// Path to the OpenSCAD executable for file invocation
|
||||
/// (Default value is set the default install directory on Windows)
|
||||
/// </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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ColoredObject.cs" />
|
||||
<Compile Include="DataBinding\BindableBoolean.cs" />
|
||||
<Compile Include="DataBinding\VariableCalculator.cs" />
|
||||
<Compile Include="DataBinding\CompoundVariable.cs" />
|
||||
@ -51,7 +52,6 @@
|
||||
<Compile Include="IO\IFileInvoker.cs" />
|
||||
<Compile Include="IO\IFileWriter.cs" />
|
||||
<Compile Include="Utility\Ids.cs" />
|
||||
<Compile Include="IO\OpenSCADPathFinder.cs" />
|
||||
<Compile Include="DataBinding\Binding.cs" />
|
||||
<Compile Include="DataBinding\Bindings.cs" />
|
||||
<Compile Include="DataBinding\IBindable.cs" />
|
||||
@ -75,7 +75,6 @@
|
||||
<Compile Include="Solids\Cylinder.cs" />
|
||||
<Compile Include="Solids\Sphere.cs" />
|
||||
<Compile Include="Solids\Text3D.cs" />
|
||||
<Compile Include="ColoredObject.cs" />
|
||||
<Compile Include="MinkowskiedObject.cs" />
|
||||
<Compile Include="MirroredObject.cs" />
|
||||
<Compile Include="ResizedObject.cs" />
|
||||
@ -85,7 +84,9 @@
|
||||
<Compile Include="Spatial\Vector3.cs" />
|
||||
<Compile Include="DataBinding\Variables.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Transforms\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user