guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.72k stars 219 forks source link

Request: File dialog to remember last used folder #343

Closed jerobarraco closed 5 months ago

jerobarraco commented 5 months ago

this is very annoying. every time i do open, save, export the file dialog goes to anywhere. also if it could use KDE dialogs instead of gnome one it would make me super happy.

guillaumechereau commented 5 months ago

I pushed some changes to use the tinyfiledialogs library instead of my own code for open dialogs. Not tested much yet, but normally it should use KDE dialogs on KDE systems.

jerobarraco commented 5 months ago

Awesome! Thanks a lot. I'll test it asap if the build has been created in the actions.

jerobarraco commented 5 months ago

It works! It's amazing! Thanks :) The only thing that doesn't quite work is the last folder used. When using Open it always goes to the working directory of goxel (~/bin in my case) image

when calling SaveAs it does sets the directory of the original asset image

but if i create a new file and click Save it goes back to ~/bin again image

vareille commented 5 months ago

Hi, I've just implemented the correct behaviour for kdialog in tinyfiledialogs (I mean: using the last folder). it's in version 3.17 Give it a try

jerobarraco commented 5 months ago

Thanks. I just reviewed the commit for action 200 and i can say that the logic implemented works as implemented. BUT, it still the same problem steps:

  1. open image
  2. save as : Dialog is correct folder
  3. Use menu to create new
  4. Save As: dialog is wrong folder (~/bin). Expected: last used folder.

it would be even better if it could remember the last used folder even after reboots.

so my requests would be to remember last used folder, and to default to that for open and save dialogs. and if possible remember after closing the software.

jerobarraco commented 5 months ago

i've made a stub proposal for what i want. this will help me a lot. but it has some downsides.

1) it doesn't remember the last folder after closing the software (i don't have the time andi dont know much about goxel to do this myself)

2) the open path and saved path are stored separately so it might suck a bit.

also i've edited the code on github so it may not compile or may crash.

vareille commented 5 months ago

on this github repo, you are using v3.16.2 make sure you use 3.17 (and better)

how are you calling tinyfd_saveFileDialog() exactly ? what are you passing as aDefaultPathAndOrFile ?

guillaumechereau commented 5 months ago

I updated to the last version on tinyfiledialog now. This code is currently quite messy in goxel, but currently the logic is:

if we have a current goxel file with a known saved path, we pass the pass to both tinyfd_saveFileDialog and tinyfd_openFileDialog. If we don't have a current file, we pass "untitled.gox" to save and NULL to open.

What I am not sure about: if we just pass a file name (not a path) to tinyfd_saveFileDialog, will it still attempt to move to the last used directory?

vareille commented 5 months ago

set

tinyfd_verbose =  1;

and launch your application from a command line. it will output the command line call that tinyfiledialogs is using. Let's see what it says.

guillaumechereau commented 5 months ago

I pushed a few more changes regarding this issue. Only tested a bit on Mac so far.

vareille commented 5 months ago

Nobody here has confirmed that tinyfiledialogs v3.17 doesn't use the last folder :

guillaumechereau commented 5 months ago

I don’t have much time right now, but as far as I could tell it worked fine in last commit. I’ll test it more before the next release to ensure there are no corner cases on all desktop platform. On a side note Goxel should now save the list of recently used files so that’s another way to simplify reopening previously used files.

On Sat, Jan 20, 2024 at 10:08 PM vareille @.***> wrote:

Nobody here has confirmed that tinyfiledialogs v3.17 doesn't use the last folder :

  • jerobarraco seems to have tested v3.16 (which didn't have the last folder feature implemented)
  • guillaumechereau has updated this project with tinyfiledialogs v3.17.x didn't try the last folder feature.

— Reply to this email directly, view it on GitHub https://github.com/guillaumechereau/goxel/issues/343#issuecomment-1902104933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2JH44C3TXD2MHZXTYZTDYPPFV7AVCNFSM6AAAAABBZ2NCK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGEYDIOJTGM . You are receiving this because you commented.Message ID: @.***>

jerobarraco commented 5 months ago

where can i obtain 3.17? @vareille

last one i tested was the build from action 200.

jerobarraco commented 5 months ago

i've just tried build 204 and it works as desired! thanks a lot! it even remembers the directory across reboots! Awesome!

guillaumechereau commented 5 months ago

OK I'll close this for now then.