Windows: Implement System_ShareFile as a Save As dialog

Win32 has no share sheet hookup yet, so sharing a file offers to save a
copy of it. ShareFilesAsZip no longer needs an app cache directory, which
Windows doesn't set; it falls back to the memstick cache folder through
DIRECTORY_APP_CACHE. The save dialog now asks before overwriting.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-11 21:52:38 +02:00
1 parent 7cab022eaf
commit 0d032fa2ee
3 files changed
+38 -4

No files matched your search

+4 -3
View File
@@ -30,14 +30,15 @@
#include "Common/System/Request.h"
#include "Common/System/System.h"
#include "Common/TimeUtil.h"
#include "Core/Config.h"
#include "Core/Util/PathUtil.h"
#include "UI/ShareFiles.h"
// How long a shared zip is kept for the receiving app to read.
static constexpr int64_t SHARE_KEEP_SECONDS = 60 * 60;
static Path ShareDirectory() {
return g_Config.appCacheDirectory / "share";
// Falls back to the memstick cache folder on platforms without an app cache directory (Windows).
return GetSysDirectory(DIRECTORY_APP_CACHE) / "share";
}
// Deletes the folders of earlier shares (named by their time) once they're old enough.
@@ -57,7 +58,7 @@ static void CleanUpOldShares(int64_t now) {
}
bool CanShareFiles() {
return System_GetPropertyBool(SYSPROP_SUPPORTS_SHARE_FILE) && !g_Config.appCacheDirectory.empty();
return System_GetPropertyBool(SYSPROP_SUPPORTS_SHARE_FILE);
}
bool ShareFilesAsZip(std::string_view zipName, const std::vector<ShareZipEntry> &files) {