-
Notifications
You must be signed in to change notification settings - Fork 38
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
bug:t.SetStartDir() is not working #76
Comments
I think that changes the current directory of the whole application binary? That will likely have negative effects on any other code that uses PWD for path lookups. |
You're right to think about it. My requirement is that when the terminal is opened, the starting directory is the directory I specify, not the location of the program itself. For example: when run test.exe, by default, the starting directory of the terminal is the location of the program, such as e://apps/test.exe. Fyne-io/terminal provides a method to specify the initial directory: // SetStartDir can be called before one of the Run calls to specify the initial directory.
func (t *Terminal) SetStartDir(path string) {
t.startDir = path
} This method is very useful for me. But it didn't work (see above). In my application requirements, I need to open different terminal Windows. The start directory for each terminal is loaded from the configuration file, rather than requiring a manual cd replacement, which is more convenient. |
Yes, absolutely. I'm just saying that I think there should be a better fix that doesn't have the negative effects discussed above (I'm not a Windows user though so can't help with that). |
When I use “fyne-io/terminal” in a Windows environment, I want to use
t.SetStartDir()
to set the initial directory, but I found that it's not working.I discovered that a line of code is missing in the term_window.go file to apply the t.SetStartDir() .
I add
os.Chdir(t.startingDir())
in method startPTY().It worked:
The text was updated successfully, but these errors were encountered: