Fix export - double dialog windows on writing over existing file#3526
Conversation
|
Export showed 2 overwrite dialogs before checkout. After checkout, 1 overwrite dialog is shown. Pull request works as expected. |
| // Get first extension from selected dropdown. | ||
| // i.e. ".wav" from "WAV-File (*.wav), Dummy-File (*.dum)" | ||
| suffix = efd.selectedNameFilter().mid( stx + 2, etx - stx - 2 ).split( " " )[0].trimmed(); | ||
| exportFileName.remove( "." + suffix ); |
There was a problem hiding this comment.
Two observations about remove(...)...
- By defaul it's case insensitive by default which can cause issues on Mac and Windows, since they're both case-insensitive (yes, Mac is too!)
- This will remove all instances of e.g.
.wav, so there are some edge cases wheremy.wav.file.wavmight get snagged, no?
Fixed... I think.
Yes. Will think. Think not easy. Sad. |
Umcaruje
left a comment
There was a problem hiding this comment.
Tested this out, can confirm it fixes the issue 👍
|
@zonkmachine can we merge or do you have something to add to this PR? |
|
Tested locally, fixed double export dialog issue for me. |
I'm not near my build machine so I can't work on this right now but I'm happy with a merge. @tresf had made some points above that I also can't test or do anything about right now. |
|
Ok no objections to a merge for 3 days, merging this. If there are any issues, they can be opened on the tracker. |
Cool! I'll test this later on and there are still questions from @tresf unanswered. Will get to that. |
|
There are still some logical problems. Linux can have There's also the double-extension problem, where |
…S#3526) * Fix export - double dialog windows on writing over existing file * Case sensitivity
…S#3526) * Fix export - double dialog windows on writing over existing file * Case sensitivity
|
@tresf I'm looking at fixing the two issues you mention above. I haven't found a way to force any actual bug to appear though. The case sensitivity issue should be fixed by: diff --git a/src/core/Song.cpp b/src/core/Song.cpp
index ba2659a..6e9b382 100644
--- a/src/core/Song.cpp
+++ b/src/core/Song.cpp
@@ -1414,7 +1414,11 @@ void Song::exportProject( bool multiExport )
// Get first extension from selected dropdown.
// i.e. ".wav" from "WAV-File (*.wav), Dummy-File (*.dum)"
suffix = efd.selectedNameFilter().mid( stx + 2, etx - stx - 2 ).split( " " )[0].trimmed();
- exportFileName.remove( "." + suffix, Qt::CaseInsensitive );
+ Qt::CaseSensitivity cs = Qt::CaseSensitive;
+#if defined(LMMS_BUILD_APPLE) || defined(LMMS_BUILD_WIN32) || defined(LMMS_BUILD_WIN64)
+ cs = Qt::CaseInsensitive;
+#endif
+ exportFileName.remove( "." + suffix, cs );
if ( efd.selectedFiles()[0].endsWith( suffix ) )
{However. I intend to fix the problem of using |
|
FYI, |
Actually no. It operates on existing files. I'll come up with something else... |
|
I think we can address the |
|
Thanks for chipping in! I'll look into chop() with endsWith(). |
|
Also just bumped into QTBUG-59401, an issue with dots in the path and |
|
Here is the original Qt issue I tried to solve in #2230 with probing the suffix. https://bugreports.qt.io/browse/QTBUG-11352 |
…S#3526) * Fix export - double dialog windows on writing over existing file * Case sensitivity
If writing over an existing file on export you are prompted twice. See comment here:
#3516 (comment)
Issue introduced here: #2230
@Umcaruje I had this fix lying around already but hadn't tested it properly. It looks like a fix but needs more testing.