@@ -38,16 +38,17 @@ class Autosave final : public Timer
3838 }
3939
4040 // Call this whenever we load a file
41- static void checkForMoreRecentAutosave (File& patchPath , PluginEditor* editor, std::function<void (File, File )> callback)
41+ static void checkForMoreRecentAutosave (URL const & patchUrl , PluginEditor* editor, std::function<void (URL const &, URL const & )> callback)
4242 {
43+ auto patchPath = patchUrl.getLocalFile ();
4344 auto lastAutoSavedPatch = autoSaveTree.getChildWithProperty (" Path" , patchPath.getFullPathName ());
4445 auto const autoSavedTime = static_cast <int64>(lastAutoSavedPatch.getProperty (" LastModified" ));
4546 auto const fileChangedTime = patchPath.getLastModificationTime ().toMilliseconds ();
4647 if (lastAutoSavedPatch.isValid () && autoSavedTime > fileChangedTime) {
4748 auto const timeDescription = RelativeTime ((autoSavedTime - fileChangedTime) / 1000 .0f ).getApproximateDescription ();
4849
4950 Dialogs::showMultiChoiceDialog (
50- &editor->openedDialog , editor, " Restore autosave?\n (last autosave is " + timeDescription + " newer)" , [lastAutoSavedPatch, patchPath, callback, editor](int const dontUseAutosaved) {
51+ &editor->openedDialog , editor, " Restore autosave?\n (last autosave is " + timeDescription + " newer)" , [lastAutoSavedPatch, patchUrl, patchPath, callback, editor](int const dontUseAutosaved) {
5152 if (!dontUseAutosaved) {
5253 MemoryOutputStream ostream;
5354 Base64::convertFromBase64 (ostream, lastAutoSavedPatch.getProperty (" Patch" ).toString ());
@@ -56,16 +57,16 @@ class Autosave final : public Timer
5657 glob_forcefilename (editor->pd ->generateSymbol (patchPath.getFileName ().toRawUTF8 ()), editor->pd ->generateSymbol (patchPath.getParentDirectory ().getFullPathName ().replaceCharacter (' \\ ' , ' /' ).toRawUTF8 ()));
5758 auto patchFile = File::createTempFile (" .pd" );
5859 patchFile.replaceWithText (autosavedPatch);
59- callback (patchFile, patchPath );
60+ callback (URL ( patchFile), patchUrl );
6061 }
6162 else {
62- callback (patchPath, patchPath );
63+ callback (URL ( patchPath), patchUrl );
6364 }
6465
6566 },
6667 { " Yes" , " No" });
6768 } else {
68- callback (patchPath, patchPath );
69+ callback (patchUrl, patchUrl );
6970 }
7071 }
7172
0 commit comments