Flow-Launcher / Flow-Launcher/Flow.Launcher

BUG: Executable started with incorrect current directory environment variable set

Open
#3,855 6 comments 1 reaction 0 assignees View on GitHub
bug keep-fresh Needs investigation
Dominant language
C#
Stars
15.6k
Forks
644
Avg merge
3d 14h
Merged PRs (30d)
4

Description

### Checks

- [x] I have checked that this issue has not already been reported.

- [x] I am using the latest version of Flow Launcher.

- [ ] I am using the prerelease version of Flow Launcher.

### Problem Description

When opening a .exe with Flow, the Current Directory path is set to "%systemroot%/system32" instead of the folder where the app is located.

### To Reproduce

1. Open the test application as you normally would, without using Flow.
2. Open the same application using the Flow launcher.
3. In the app opened with Flow, the "Current Directory" is set to %systemroot%/system32. In the other, it is not.

I've built a simple .Net 9 console app to reproduce this issue, you can find below all the steps I used to set this up:
1. In a terminal window, run `dotnet new console -o FlowTest` to create the app
2. Enter the directory created by the previous step, in this case, it was FlowTest: `cd FlowTest`
3. Replace the contents of Program.cs with the following code snippet:
```csharp
Console.WriteLine("Flow Launcher Test");
Console.WriteLine();
Console.WriteLine($"Current Directory: {Environment.CurrentDirectory}");
Console.WriteLine($"Base Directory: {AppDomain.CurrentDomain.BaseDirectory}");
Console.WriteLine($"Process Path: {Environment.ProcessPath}");
Console.WriteLine($"OS Version: {Environment.OSVersion}");
Console.WriteLine();
Console.Read();
```
3. Build the project with `dotnet build -c Release`

### Screenshots

Image

### Flow Launcher Version

1.20.2

### Windows Build Number

10.0.22631.0

### Error Log

```shell

Replace this line with the important log contents.

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.