View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001702 | OpenMPT | Installer and Update | public | 2023-05-07 12:52 | 2024-10-10 08:13 |
Reporter | Saga Musix | Assigned To | manx | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | assigned | Resolution | open | ||
Product Version | OpenMPT 1.31.02.00 / libopenmpt 0.7.1 (upgrade first) | ||||
Target Version | OpenMPT 1.?? (long term goals) | ||||
Summary | 0001702: Trying to update two OpenMPT installations at the same time results in conflicts | ||||
Description | If you have two portable OpenMPT installations on the same machine and try to update them roughly at the same time, conflicts will arise when trying to copy temporary files. Optimally, the two installations should extract their temporary files to different locations so that they don't conflict. | ||||
Tags | No tags attached. | ||||
Has the bug occurred in previous versions? | |||||
Tested code revision (in case you know it) | |||||
This uses a temp directory inside the portable installation for unpacking the update. Completely untested as of now. update-portable-local-temp-v1.patch (3,406 bytes)
Index: mptrack/UpdateCheck.cpp =================================================================== --- mptrack/UpdateCheck.cpp (revision 19257) +++ mptrack/UpdateCheck.cpp (working copy) @@ -742,9 +742,18 @@ } -void CUpdateCheck::CleanOldUpdates(const CUpdateCheck::Settings & /* settings */ , const CUpdateCheck::Context & /* context */ ) +mpt::PathString CUpdateCheck::GetUpdateTempDirectory(bool portable) { - mpt::PathString dirTemp = mpt::common_directories::get_temp_directory(); + if(portable) + { + return theApp.GetInstallPath().WithTrailingSlash() + P_("Temp") + mpt::PathString::FromNative(mpt::RawPathString(1, mpt::PathString::GetDefaultPathSeparator())); + } + return mpt::common_directories::get_temp_directory(); +} + + +void CUpdateCheck::CleanOldUpdates(mpt::PathString dirTemp) +{ if(dirTemp.empty()) { return; @@ -763,6 +772,16 @@ } +void CUpdateCheck::CleanOldUpdates(const CUpdateCheck::Settings & /* settings */ , const CUpdateCheck::Context & /* context */ ) +{ + if(theApp.IsPortableMode()) + { + CleanOldUpdates(GetUpdateTempDirectory(true)); + } + CleanOldUpdates(GetUpdateTempDirectory(false)); +} + + void CUpdateCheck::SendStatistics(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings, const std::string &statistics) { if(settings.sendStatistics) @@ -1118,12 +1137,13 @@ } UpdateProgress(_T("Preparing download..."), 6.0); - mpt::PathString dirTemp = mpt::common_directories::get_temp_directory(); + mpt::PathString dirTemp = CUpdateCheck::GetUpdateTempDirectory(theApp.IsPortableMode()); + ::CreateDirectory(mpt::support_long_path(dirTemp.AsNative()).c_str(), NULL); mpt::PathString dirTempOpenMPT = dirTemp + P_("OpenMPT") + mpt::PathString::FromNative(mpt::RawPathString(1, mpt::PathString::GetDefaultPathSeparator())); + ::CreateDirectory(mpt::support_long_path(dirTempOpenMPT.AsNative()).c_str(), NULL); dirTempOpenMPTUpdates = dirTempOpenMPT + P_("Updates") + mpt::PathString::FromNative(mpt::RawPathString(1, mpt::PathString::GetDefaultPathSeparator())); + ::CreateDirectory(mpt::support_long_path(dirTempOpenMPTUpdates.AsNative()).c_str(), NULL); updateFilename = dirTempOpenMPTUpdates + mpt::PathString::FromUnicode(downloadinfo.filename); - ::CreateDirectory(mpt::support_long_path(dirTempOpenMPT.AsNative()).c_str(), NULL); - ::CreateDirectory(mpt::support_long_path(dirTempOpenMPTUpdates.AsNative()).c_str(), NULL); { Index: mptrack/UpdateCheck.h =================================================================== --- mptrack/UpdateCheck.h (revision 19257) +++ mptrack/UpdateCheck.h (working copy) @@ -130,6 +130,8 @@ // v3 static std::string GetStatisticsDataV3(const Settings &settings); // UTF8 + static mpt::PathString GetUpdateTempDirectory(bool portable); + protected: static void StartUpdateCheckAsync(bool autoUpdate); @@ -146,6 +148,8 @@ static UpdateCheckResult SearchUpdate(const CUpdateCheck::Context &context, const CUpdateCheck::Settings &settings, const std::string &statistics); // may throw + static void CleanOldUpdates(mpt::PathString dirTemp); + static void CleanOldUpdates(const CUpdateCheck::Settings &settings, const CUpdateCheck::Context &context); static void SendStatistics(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings, const std::string &statistics); // may throw |
|
r19283 (trunk). This needs at least some testing before getting merged into 1.31. |
|
r19295 (1.31) Updating multiple portable installations in parallel should work now. I will leave this issue open, though. Portable installations will still cleanup (and conflict) with system-wide installations because they will still cleanup update files in the user temp directory. We should wait at least 1 release before we remove that. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2023-05-07 12:52 | Saga Musix | New Issue | |
2023-05-07 13:08 | manx | Assigned To | => manx |
2023-05-07 13:08 | manx | Status | new => confirmed |
2023-05-07 17:20 | manx | Note Added: 0005722 | |
2023-05-07 17:20 | manx | File Added: update-portable-local-temp-v1.patch | |
2023-05-13 12:39 | manx | Status | confirmed => assigned |
2023-05-13 12:44 | manx | Note Added: 0005723 | |
2023-05-14 19:43 | manx | Note Added: 0005725 | |
2024-10-10 08:07 | manx | Target Version | => OpenMPT 1.?? (long term goals) |
2024-10-10 08:13 | manx | Category | General => Installer and Update |