View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001837 | OpenMPT | Feature Request | public | 2024-11-11 10:29 | 2024-11-11 21:06 |
Reporter | minebrandon | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | OpenMPT 1.32.00.* (current testing) | ||||
Summary | 0001837: Autosaves should default to it's own folder instead of next to the original file | ||||
Description | Whenever people first get OpenMPT and just do minor things like mute channels or change samples in a gateway mod of your choosing, the program just starts pumping out new files that are pretty much identical to the original and take up screen space and have ugly file names. It practically punishes users for using the program by flooding whichever folder that contains their neatly organized collection of modules with worthless junk and given that unlike blender most of the files come from other people and there's usually like 3 autosaves per modules, there can end up being more autosaves than actual modules in a folder meant for music listening which makes it annoying to find the actual module you want to listen to. So eventually the user will turn off autosaves to avoid this flood and they might even start making their own music, but if their computer dies or they look at OPL the wrong way they lose all of their progress. So in my opinion and in the opinions of some other people I was talking to too, there should be a different solution, and what I was thinking of is what if the "%appdata%/openmpt" folder there was a folder named "Autosaves" where the Autosaves go instead of clogging up the music folder, and to access it you could click a button in the file drop down menu after "Open Template" that says "Open Autosaves" and it opens the folder and shows all of the autosaved modules that are stored in there. In the advanced settings you should still be able to change it and maybe even go back to how it was originally done, but this is just a thought I had in order to make the program less annoying to new comers! | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Has the bug occurred in previous versions? | |||||
Tested code revision (in case you know it) | |||||
https://github.com/OpenMPT/openmpt/pull/30 Here's my attempt to implement this. It's not great, but I tried. Hopefully this (or a better version) gets merged. |
|
This is not as easy as it looks from a first glance. I can fully understand the frustration with autosave files getting placed inside collection folders. However, this is frankly not the use case we are most concerned about with the autosave feature. We already have the setting available to change that (https://wiki.openmpt.org/Manual:_Setup/Paths_/_Auto_Save#Backup_and_Auto_Save). For autosaves of files a user is actually actively working on, the original file folder is the correct location, though. That's where I would expect autosaves to be. And there is also a technical limitation why this is arguably the only place they can be in case the user is using External Samples: If the file gets autosaved somewhere else, either (1) the relative filenames of external samples would need to get changed (making the autosaved file not an in-place replacement of the original file anymore), or (2) the autosaved file will not be openable from the fixed location where it got autosaved to (this is what currently happens), or (3) all relative external samples would (potentially) need to get saved to the autosave location as well. Because of the (current) technical limitation of (2), IMHO the only viable default is what we are currently doing. And this is also why I do not think that providing a menu to browse autosaved file in an explicit location to be all that useful. It will fail for files with external samples. Also, I do not think autosaving to %Temp% is a good idea. That folder is far too volatile. We should consider changing the current fallback for new files away from %Temp% and into %AppData%. That however has the problem of accumulating old data that never gets cleaned and which the user does not necessarily know about. We can consider choosing the autosave location in the Welcome Dialog which gets shown only on the first run of OpenMPT. |
|
I forgot about external samples. Should I close the PR or keep it up? |
|
@cs127 I guess you can close that for now. We first should come to a conclusion of what we actually want here, and then discuss which (if any) internal things need additional changes to be able to achieve that. |
|
FWIW, we do have the option to just not use relative paths for external samples in autosaves. The logic exists. Right now the external paths are relative to the autosave location rather than the song location. Also, if we were going to use a non-temporary folder, it should be in %localappdata% by default, not %appdata%, from my understanding of the rules. %localappdata% was originally meant for data that is not to be synced between workstations when a user profile is shared between multiple machines. Of course most people don't use this feature of Windows anyway, but still %localappdata% is usually treated more as an ephemeral location and I think auto-save fits that location a bit better. |
|
So, we are not doing (2) at the moment. Looks like I misunderstood the logic somehow. In any case, for Autosave, the saved file really should be in-place replaceable for the original file IMHO, which is only the case when not saving to a fixed location, being another argument for not changing the current default. Yeah, %localappdata% is probably a better fit. |
|
As a first step, we could disable relative file paths in autosaved files then. |
|
Only when saved to a fixed location. When saving to the same folder as the original file, the external paths should be in exactly the same format as for a regular save. I do not care that much what we do for external samples when autosave is saved to a fixed location, but in any case, we should document what we do. and document the problems fixed-location-autosave can cause in general when using external samples (i.e. explicitly document directly-opening-from-fixed-location and replacing-original-file-with-autosaved-copy). |
|
Suggested patch as step 1: Disable relative paths for external samples when using a user-specified folder to autosave into. no-relative-paths.patch (2,624 bytes)
Index: common/mptPathString.cpp =================================================================== --- common/mptPathString.cpp (revision 22162) +++ common/mptPathString.cpp (working copy) @@ -55,7 +55,7 @@ using namespace path_literals; using char_type = RawPathString::value_type; mpt::PathString result = path; - if(path.empty()) + if(path.empty() || relativeTo.empty()) { return result; } @@ -79,7 +79,7 @@ using namespace path_literals; using char_type = RawPathString::value_type; mpt::PathString result = path; - if(path.empty()) + if(path.empty() || relativeTo.empty()) { return result; } Index: mptrack/AutoSaver.cpp =================================================================== --- mptrack/AutoSaver.cpp (revision 22162) +++ mptrack/AutoSaver.cpp (working copy) @@ -141,7 +141,7 @@ { mpt::PathString name = GetBasePath(modDoc, true) + GetBaseName(modDoc); const CString timeStamp = CTime::GetCurrentTime().Format(_T(".AutoSave.%Y%m%d.%H%M%S.")); - name += mpt::PathString::FromCString(timeStamp); //append backtup tag + timestamp + name += mpt::PathString::FromCString(timeStamp); // Append backtup tag + timestamp name += mpt::PathString::FromUnicode(modDoc.GetSoundFile().GetModSpecifications().GetFileExtension()); return name; } @@ -167,8 +167,8 @@ case MOD_TYPE_MOD: success = sndFile.SaveMod(f); break; case MOD_TYPE_S3M: success = sndFile.SaveS3M(f); break; case MOD_TYPE_XM: success = sndFile.SaveXM(f); break; - case MOD_TYPE_IT: success = sndFile.SaveIT(f, fileName); break; - case MOD_TYPE_MPT: success = sndFile.SaveIT(f, fileName); break; + case MOD_TYPE_IT: success = sndFile.SaveIT(f, GetUseOriginalPath() ? fileName : mpt::PathString{}); break; + case MOD_TYPE_MPT: success = sndFile.SaveIT(f, GetUseOriginalPath() ? fileName : mpt::PathString{}); break; default: // nothing break; Index: test/test.cpp =================================================================== --- test/test.cpp (revision 22162) +++ test/test.cpp (working copy) @@ -2406,6 +2406,8 @@ VERIFY_EQUAL(mpt::RelativePathToAbsolute(P_("\\foo"), exePath), P_("C:\\foo")); VERIFY_EQUAL(mpt::AbsolutePathToRelative(P_("\\\\server\\path\\file"), exePath), P_("\\\\server\\path\\file")); VERIFY_EQUAL(mpt::RelativePathToAbsolute(P_("\\\\server\\path\\file"), exePath), P_("\\\\server\\path\\file")); + VERIFY_EQUAL(mpt::AbsolutePathToRelative(P_("C:\\OpenMPT"), mpt::PathString{}), P_("C:\\OpenMPT")); + VERIFY_EQUAL(mpt::RelativePathToAbsolute(P_("C:\\OpenMPT"), mpt::PathString{}), P_("C:\\OpenMPT")); #endif #ifdef MODPLUG_TRACKER |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2024-11-11 10:29 | minebrandon | New Issue | |
2024-11-11 10:29 | minebrandon | File Added: autosaves.jpg | |
2024-11-11 14:44 | cs127 | Note Added: 0006170 | |
2024-11-11 15:41 | manx | Note Added: 0006171 | |
2024-11-11 16:26 | cs127 | Note Added: 0006172 | |
2024-11-11 16:37 | manx | Note Added: 0006173 | |
2024-11-11 18:32 | Saga Musix | Note Added: 0006174 | |
2024-11-11 18:38 | manx | Note Added: 0006175 | |
2024-11-11 18:50 | Saga Musix | Note Added: 0006177 | |
2024-11-11 18:58 | manx | Note Added: 0006178 | |
2024-11-11 21:06 | Saga Musix | Note Added: 0006179 | |
2024-11-11 21:06 | Saga Musix | File Added: no-relative-paths.patch |