Save dialogue - Glitchy filename test
As mentioned here, there is a remaining problem with the save dialogue.
Quote by @tresf
There's also the double-extension problem, where .remove() makes no guarantee that the extension is at the end of the file. Again, very rare edge-case but when it happen to someone it won't be obvious. For example ocean.waves.wav would become oceanes.wav. :)
Basically, we test for already existing files to avoid saving over them. We also test for existing file minus suffix as you can enter just the name and let LMMS/Qt add the suffix but this earlier didn't test for the proposed name 'with' suffix so, as an example, saving the project 'test' when 'test.mmp' was present would save over test.mmp (See #2230). The remaining issue is that all occasions of the suffix is removed from the filename when testing. Not only the suffix proper on the end.
Related pull requests: https://github.com/LMMS/lmms/pull/2230 https://github.com/LMMS/lmms/pull/3526 https://github.com/LMMS/lmms/pull/4768
Meanwhile, the original issue I tried to solve has seem to have been at least partially fixed... :whale: I can recreate the bug on LinuxMint-17.3 but not on LinuxMint-18.3 . The original issue pointed to a possible bug in Qt and it seem to have been fixed in the meantime.
I'm looking into the possibility of reverting, in order: #4768 419321dd0146d9893f7934ef852cb54994ffd26f #3526 9bdc0119049f41d0859c26e7145b5c8a36446eee #2230 e1c598ba2147914f755a016c28ac33baffad283d
#2230 has changes in it that should be kept but it may be least messy to revert it in it's entirety and pull those again separately.
I will try and update my machine and test the issue first to see the state of it before proceeding.
In order to test the issue on lmms 1.1.3 or older.
Create an issue "test.mmp" Export as "test.wav" Once more export as "test.wav" and note how you are prompted with a warning that the file exists. Export as just "test". The software should catch that "test.wav" exists as it's going to complete the name.
The case above is if you go along with the project name as your render name. If you instead type in a new name altogether for the rendered project the issue seem to be there still.
@zonkmachine When do you have time to solve this?
"May be messy" sounds like "should be master". Perhaps a better question is... is this needed for 1.2?
Two weeks, no answer. Re-milestoning.
May I take this one ?
Yes indeed but I would caution against it. I think your looking at a rewrite rather than troubleshooting. I was the one to mess this up and I failed to fix it in stable-1.2. After many changes in master it's beyond what I can handle but I'll be happy to test a PR.
So assign it to me and I'll have a try.
I took some time reading the different issues and comments related to this issue and this is one idea to implement. I present it before coding it (is seems ok).
[Updated] if fileName's suffix is the selected dialog one then test if file exists else if fileName's suffix is part of other possible suffix in the dialog then keep this suffix and test if file exists else add the dialog's suffix to the file and test if file exists
This would force the creation of file with valid suffix.
As the usage of mmpz or mmp is based on configuration, we could have the filedialog only proposing the possible format and then the file dialog would have always only one possible format on a selected format line.
This would force the creation of file with valid suffix.
OK. That at least sounds familiar. I'll look into this after the weekend and try and replicate the issue/s.
As the usage of mmpz or mmp is based on configuration, we could have the filedialog only proposing the possible format and then the file dialog would have always only one possible format on a selected format line.
But that is only the default file format. You can always change format later on actually saving. (I'm not sure I understand you completely here)
New Strategy : if filename has a prefix available in the dialog then test if exists else force the selected dialog suffix and test if exists
Seems to simple but logical for me.
This would force the creation of file with valid suffix.
OK. That at least sounds familiar. I'll look into this after the weekend and try and replicate the issue/s.
Yes it would be good to have a test case cause I was not able to reproduce for the moment on Linux Ubuntu.
I think the Save has no issue and the export should be addressed with #5744.