How do I save aliasdata with SaveInfo?

How do I use SaveInfo so that I can find a file after moving it? The code is quite simple.

Button 1:

Sub Action() Handles Action dim f as FolderItem = GetOpenFolderItem("") if f = Nil then Return SaveInfo = EncodeBase64(f.GetSaveInfo(volume(0))) End Sub

And Button 2:

Sub Action() Handles Action if SaveInfo = "" then Return Dim f As FolderItem = GetFolderItem(DecodeBase64(SaveInfo), FolderItem.PathTypeNative) if f <> nil then MsgBox f.NativePath End Sub

Click on Button 1, select a file, click on Button 2 and get a nice message. Now move the selected file to a different location. Click on Button 2 again and you will get no message. I’m pretty sure that this worked once upon a time. Bug or am I doing something wrong?

High Sierra + Catalina, Xojo 2019r1.1 and latest something.

@Beatrix Willius — It does not work for me either. I suspect that the older API used by Xojo is not compatible with APFS volumes.

However, I have successfully swapped SaveInfo for the more modern Bookmark used by NSURL. The target file could be found after I moved it and renamed it.

I am pretty sure MBS plugins have such Bookmark feature.

@Stphane Mons: thanks for the confirmation.

I’m already using the MBS Bookmarks for the sandboxed version of my app. So I’ll simple use that everywhere.

does the IDE track projects ok if you move them ?
that uses alias data from save info

Same result:

:frowning:
A) report that as a bug in 2019r1.1
B) recheck in in a pre-release as well
would be nice if they could revive whatever seems to have broken

Isn’t this meant to work with “GetRelative”?

Dim path As String Dim f, g As FolderItem f = New FolderItem g = f.GetRelative(f.GetSaveInfo(Volume(0).Child("Documents"), 0)) If g <> Nil Then path = g.NativePath End If

@Sam Rowlands — [quote]Isn’t this meant to work with “GetRelative”?[/quote]
Only if you created SaveInfo as relative. Otherwise, it is an absolute alias

According to the docs relative is the default:

If I’m not senile then the code must have worked once upon a time.

@Beatrix Willius — I think my first intuition was right: SaveInfo does not work on APFS volumes but it still does on HFS+ volumes. I have just tried your code on an external HFS+ volume and it worked as intended, but not on my internal APFS volume.