How do I save aliasdata with SaveInfo?

  1. 7 weeks ago

    Beatrix W

    Jul 26 Pre-Release Testers, Third Party Store Europe (Germany)

    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.

  2. @Beatrix W — 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.

  3. Beatrix W

    Jul 26 Pre-Release Testers, Third Party Store Europe (Germany)

    @Stéphane 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.

  4. Norman P

    Jul 26 Pre-Release Testers, Xojo Pro great-white-software.com/blog

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

  5. Beatrix W

    Jul 26 Pre-Release Testers, Third Party Store Europe (Germany)

    Same result:

    -image-

  6. Norman P

    Jul 26 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    :(
    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

  7. Sam R

    Jul 26 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    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
  8. @Sam R

    Isn't this meant to work with "GetRelative"?

    Only if you created SaveInfo as relative. Otherwise, it is an absolute alias

  9. Beatrix W

    Jul 28 Pre-Release Testers, Third Party Store Europe (Germany)

    According to the docs relative is the default:

    SaveInfoDefaultMode 0 The FolderItem should be open in any way that it can possibly be created. This is the default value.

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

  10. @Beatrix W — 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.

or Sign Up to reply!