Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Mar 21, 2024
1 parent 073115b commit 0e07d78
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
3 changes: 0 additions & 3 deletions lib/bootstrap/bootstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
<ProjectReference Include="..\..\src\double\Edge.js\Edge.js.csproj" />
<ProjectReference Include="..\..\src\double\Edge.js.CSharp\Edge.js.CSharp.csproj" />
</ItemGroup>
<ItemGroup >
<Reference Include="System.Runtime"/>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion lib/edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (process.env.EDGE_DEBUG) {
}
if (edgeNative.match(/edge_coreclr\.node$/i)) {
// Propagate the choice between desktop and coreclr to edge-cs; this is used in deciding
// how to compile literal C# at https://github.com/tjanczuk/edge-cs/blob/master/lib/edge-cs.js
// how to compile literal C# at https://github.com/agracio/edge-js-cs/blob/master/lib/edge-cs.js
process.env.EDGE_USE_CORECLR = 1;
}
if (process.env.EDGE_USE_CORECLR && !process.env.EDGE_BOOTSTRAP_DIR && fs.existsSync(path.join(__dirname, 'bootstrap', 'bin', 'Release', 'netcoreapp3.1', 'bootstrap.dll'))) {
Expand Down
3 changes: 1 addition & 2 deletions src/common/edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool HasEnvironmentVariable(const char* variableName)
#pragma unmanaged
#endif
#ifdef HAVE_CORECLR
#if NODE_MAJOR_VERSION >= 10
#if NODE_MAJOR_VERSION >= 10
NAN_MODULE_WORKER_ENABLED(edge_coreclr, init)
#else
NODE_MODULE(edge_coreclr, init)
Expand All @@ -93,5 +93,4 @@ bool HasEnvironmentVariable(const char* variableName)
NODE_MODULE(edge_nativeclr, init)
#endif
#endif

// vim: ts=4 sw=4 et:
12 changes: 11 additions & 1 deletion src/double/Edge.js/dotnet/EdgeJs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public Task<object> InitializeInternal(object input)
[DllImport("node.dll", EntryPoint = "?Start@node@@YAHHQEAPEAD@Z", CallingConvention = CallingConvention.Cdecl)]
static extern int NodeStartx64(int argc, string[] argv);

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern int GetShortPathName(string LongPath, StringBuilder ShortPath, int BufferSize);

[DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
static extern int LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpLibFileName);

Expand Down Expand Up @@ -116,7 +119,14 @@ public static Func<object,Task<object>> Func(string code)
argv.Add(p);
}
}
argv.Add(Path.Combine(AssemblyDirectory, "edge", "double_edge.js"));

// Workaround for unicode characters in path
string path = AssemblyDirectory + "\\edge\\double_edge.js";
StringBuilder shortPath = new StringBuilder(255);
int result = GetShortPathName(path, shortPath, shortPath.Capacity);
argv.Add(shortPath.ToString());
// End workaround for unicode characters in path

argv.Add(string.Format("-EdgeJs:{0}", Path.Combine(edgeDirectory, "EdgeJs.dll")));
nodeStart(argv.Count, argv.ToArray());
waitHandle.Set();
Expand Down

0 comments on commit 0e07d78

Please sign in to comment.