Skip to content
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

Allow the last used directory when opening a file to be saved in the Compaion config file #4813

Open
1 task done
pagrey opened this issue Mar 26, 2024 · 5 comments · May be fixed by #5161
Open
1 task done

Allow the last used directory when opening a file to be saved in the Compaion config file #4813

pagrey opened this issue Mar 26, 2024 · 5 comments · May be fixed by #5161
Labels
companion Related to the companion software enhancement ✨ New feature or request

Comments

@pagrey
Copy link

pagrey commented Mar 26, 2024

Is there an existing issue for this feature request?

  • I have searched the existing issues

Is your feature request related to a problem?

I have noticed Companion doesn't write the lastDir entry anymore so File>Open defaults to the main EdgeTX folder. It seems that my entry had carried over from previous config files as I have updated Companion (possibly back as far as OpenTX). Starting with no previous config file the entry isn't created. Manually editing the config file and adding/editing lastDir= works. It would be nice for the lastDir entry to be written so you can easily open files in previous directory. The lastDir entry seems tied to eepromDir but there isn't really an eeprom folder in the settings.

Describe the solution you'd like

This simple change seems to work for me and lastDir is created and updated in the config file.
main...pagrey:edgetx:save-dir

I'm really just curious why openFile always sets updateLastUsedDir false, as far back as I looked it has been false. I gave up when I started seeing OpenTX. I don't consider this a bug, it seems to work as it is currently written.

Describe alternatives you've considered

No response

Additional context

No response

@pagrey pagrey added the enhancement ✨ New feature or request label Mar 26, 2024
@pfeerick pfeerick added the companion Related to the companion software label Mar 27, 2024
@pfeerick
Copy link
Member

Interesting... that line hasn't been changed in ... seven years... so certainly not a recent... "change" 🤪

image

Seems it was changed/added while fixing a drag and drop issue: "Enable .otx file drag&drop on main window"

cf. opentx/opentx@0a35111 and opentx/opentx#4224

@pagrey
Copy link
Author

pagrey commented Mar 27, 2024

Curious, the filename is now passed to the openFile method but the line
g.eepromDir(QFileInfo(fileName).dir().absolutePath());
is essentially removed because false is alwyas passed to the method. I don't know why the file name had to be passed to the method but since the new method does the same check
if (!fileName.isEmpty())
Seems like the fix would be to dump the boolean which doesn't do anything. I think removing it and the associated
if (updateLastUsedDir)
would work. The isEmpty already checks that you have a good value to update. I'm not suggesting to change it but that boolean doesn't do anything now other than comment out a single line of code that updates the file path.

I'm going to make the fix on my fork so the boolean is eliminated and the associated check so the eepromDir is updated. Thanks for tracking down the change, I didn't know how to do it.

@pfeerick
Copy link
Member

Using my screenshot as a reference, on GitHub, there is a button up the top that says "Blame" (right under the left pointing arrow). Normally the "Code" buttons is selected. When you hit the "Blame" button, it updates to the view shown there, and you can see when lines were last edited, and jump to the relevant commits. If you want to tunnel back in time further for a particular line, you click on the share icon with a ... trail behind it? ... on that line, and it jumps further back.

Looking forward to a PR clearing that up ;)

@elecpower
Copy link
Collaborator

@pagrey I see it has been a couple of months since you advised you would submit a PR to fix this. Are you still planning to do so or would you like for me to action?

@pagrey pagrey linked a pull request Jun 12, 2024 that will close this issue
@pagrey
Copy link
Author

pagrey commented Jun 12, 2024

Since it has come up I have created a pull request #5161 with my very simple fix. @elecpower please take any action you would like to, this is just my basic fix for the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
companion Related to the companion software enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants