Skip to content

Commit

Permalink
Исправлена ошибка поиска библиотек
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Jan 30, 2021
1 parent bd9046d commit 3395f4b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/oscript/CgiBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public override int Execute()

private int RunCGIMode(string scriptFile)
{
var builder = ConsoleHostBuilder.Create();
builder.UseEntrypointConfigFile(scriptFile)
var builder = ConsoleHostBuilder
.Create(scriptFile)
.AddAssembly(Assembly.GetExecutingAssembly());

var engine = ConsoleHostBuilder.Build(builder);
Expand Down
3 changes: 1 addition & 2 deletions src/oscript/CheckSyntaxBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public CheckSyntaxBehavior(string path, string envFile, bool isCgi = false)

public override int Execute()
{
var builder = ConsoleHostBuilder.Create();
builder.UseEntrypointConfigFile(_path);
var builder = ConsoleHostBuilder.Create(_path);
var hostedScript = ConsoleHostBuilder.Build(builder);
hostedScript.Initialize();

Expand Down
5 changes: 3 additions & 2 deletions src/oscript/ConsoleHostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ namespace oscript
{
internal static class ConsoleHostBuilder
{
public static IEngineBuilder Create()
public static IEngineBuilder Create(string codePath)
{
var builder = new DefaultEngineBuilder();
builder.SetDefaultOptions()
.AddAssembly(typeof(ArrayImpl).Assembly)
.UseSystemConfigFile()
.UseEnvironmentVariableConfig("OSCRIPT_CONFIG");
.UseEnvironmentVariableConfig("OSCRIPT_CONFIG")
.UseEntrypointConfigFile(codePath);

builder.UseFileSystemLibraries();

Expand Down
6 changes: 2 additions & 4 deletions src/oscript/ExecuteScriptBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ public override int Execute()

SystemLogger.SetWriter(this);

var builder = ConsoleHostBuilder.Create();
builder
.UseEntrypointConfigFile(_path)
.WithDebugger(DebugController);
var builder = ConsoleHostBuilder.Create(_path);
builder.WithDebugger(DebugController);

var hostedScript = ConsoleHostBuilder.Build(builder);

Expand Down
2 changes: 1 addition & 1 deletion src/oscript/MakeAppBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void CreateDump(Stream output)
{
var offset = (int)output.Length;

var builder = ConsoleHostBuilder.Create();
var builder = ConsoleHostBuilder.Create(_codePath);
builder.UseEntrypointConfigFile(_codePath);
var engine = ConsoleHostBuilder.Build(builder);
engine.Initialize();
Expand Down
3 changes: 1 addition & 2 deletions src/oscript/SerializeModuleBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public SerializeModuleBehavior(string path)

public override int Execute()
{
var builder = ConsoleHostBuilder.Create();
builder.UseEntrypointConfigFile(_path);
var builder = ConsoleHostBuilder.Create(_path);
var engine = ConsoleHostBuilder.Build(builder);

engine.Initialize();
Expand Down
4 changes: 1 addition & 3 deletions src/oscript/ShowCompiledBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public ShowCompiledBehavior(string path)

public override int Execute()
{
var builder = ConsoleHostBuilder.Create();
builder.UseEntrypointConfigFile(_path);

var builder = ConsoleHostBuilder.Create(_path);
var hostedScript = ConsoleHostBuilder.Build(builder);
hostedScript.Initialize();
ScriptFileHelper.OnBeforeScriptRead(hostedScript);
Expand Down

0 comments on commit 3395f4b

Please sign in to comment.