mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
ASP.NET process is spawned with confusing working directory #83
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tboby on GitHub (Dec 6, 2017).
Originally assigned to: @robertmuehsig, @GregorBiswanger on GitHub.
When Electron.NET starts the asp.net application process it doesn't set a cwd. This means the cwd of the running process is used. Confusingly this is the location of
electron.cmd, which isapp\node_modules\.bin\.Would it not make more sense for the asp.net application to start with its own directory as the cwd? This means calls such as
File.ReadAllLines("./appsettings.json")behave as expected.Currently that would read
app\node_modules\.bin\appsettings.jsonnotapp\bin\appsettings.json.200f511940/ElectronNET.Host/main.js (L51-L52)I think the change would be something like:
@robertmuehsig commented on GitHub (Dec 6, 2017):
Mh - I'm not sure what the working directory really is, but at least appSettings should work fine, see this https://github.com/ElectronNET/Electron.NET/issues/42 with this sample commit
24ef987471 (diff-627e2365a214cf35b5d1d98ef9b1a9c5)@robertmuehsig commented on GitHub (Dec 6, 2017):
But maybe it would be good anyway to set the working directory properly - good catch!
@jcphlux commented on GitHub (Dec 12, 2017):
I am using env.ContentRootPath and env.WebRootPath that might get you the path you need.
@robertmuehsig commented on GitHub (Feb 19, 2018):
It's quite late, sorry, but when did this occure? After you use "dotnet electronize build" or after "dotnet electronize start"?
@tboby commented on GitHub (Feb 19, 2018):
I thought after both, the javascript that starts the backend is the same I think.
I fixed it by manually setting the CWD in the app, but that's not ideal!