New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET process is spawned with confusing working directory #72

Closed
tboby opened this Issue Dec 6, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@tboby

tboby commented Dec 6, 2017

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 is app\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.json not app\bin\appsettings.json.

const binFilePath = path.join(__dirname, 'bin', binaryFile);
apiProcess = process(binFilePath, parameters);

I think the change would be something like:

var options = { cwd: path.join(__dirname,'bin') }
apiProcess = process(binFilePath, parameters, options);
@robertmuehsig

This comment has been minimized.

Show comment
Hide comment
@robertmuehsig

robertmuehsig Dec 6, 2017

Collaborator

Mh - I'm not sure what the working directory really is, but at least appSettings should work fine, see this #42 with this sample commit 24ef987#diff-627e2365a214cf35b5d1d98ef9b1a9c5

Collaborator

robertmuehsig commented Dec 6, 2017

Mh - I'm not sure what the working directory really is, but at least appSettings should work fine, see this #42 with this sample commit 24ef987#diff-627e2365a214cf35b5d1d98ef9b1a9c5

@robertmuehsig

This comment has been minimized.

Show comment
Hide comment
@robertmuehsig

robertmuehsig Dec 6, 2017

Collaborator

But maybe it would be good anyway to set the working directory properly - good catch!

Collaborator

robertmuehsig commented Dec 6, 2017

But maybe it would be good anyway to set the working directory properly - good catch!

@robertmuehsig robertmuehsig added this to the 0.0.8 milestone Dec 6, 2017

@jcphlux

This comment has been minimized.

Show comment
Hide comment
@jcphlux

jcphlux Dec 12, 2017

I am using env.ContentRootPath and env.WebRootPath that might get you the path you need.

jcphlux commented Dec 12, 2017

I am using env.ContentRootPath and env.WebRootPath that might get you the path you need.

@robertmuehsig

This comment has been minimized.

Show comment
Hide comment
@robertmuehsig

robertmuehsig Feb 19, 2018

Collaborator

It's quite late, sorry, but when did this occure? After you use "dotnet electronize build" or after "dotnet electronize start"?

Collaborator

robertmuehsig commented Feb 19, 2018

It's quite late, sorry, but when did this occure? After you use "dotnet electronize build" or after "dotnet electronize start"?

@robertmuehsig robertmuehsig removed this from the 0.0.8 milestone Feb 19, 2018

@tboby

This comment has been minimized.

Show comment
Hide comment
@tboby

tboby 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!

tboby commented 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!

robertmuehsig added a commit that referenced this issue Feb 19, 2018

#72

@robertmuehsig robertmuehsig added this to the 0.0.10 milestone Feb 19, 2018

GregorBiswanger added a commit that referenced this issue Jul 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment