How to open file that has moved?

  1. 7 months ago

    Markus W

    13 Jan 2019 Pre-Release Testers #JeSuisHuman New Zealand, Auc...
    Edited 7 months ago

    A declare to FSCompareFSRefs could be used on OS X, passing in the each item's MacFSRef value. Note that FSCompareFSRefs is deprecated by Apple as of 10.8, along with all of the other functions that deal with FSRefs.

    The reason NOT to use AbsolutePath etc is because Mac users (unlike Windows users) expect an app to find the document even if it has been moved (for example from a RecentItems menu).

    As FSRef is deprecated how does one deal with this now? Is there a replacement that can still open moved files?

    Could FSRef still be used on HFS+ volumes and URLpath on APFS volumes?

    @Markus W The reason NOT to use AbsolutePath etc is because Mac users (unlike Windows users) expect an app to find the document even if it has been moved (for example from a RecentItems menu).

    As FSRef is deprecated how does one deal with this now? Is there a replacement that can still open moved files?

    Could FSRef still be used on HFS+ volumes and URLpath on APFS volumes?

    Please see: http://docs.xojo.com/FolderItem.GetSaveInfo
    No plugin required.

  2. @Markus W — Even with FSRefs, the proper way to keep track of a file was to get an alias record and resolve it whenever you need it.

    Since 10.6, it has been replaced by "bookmark" accessible through CFURL or NSURL. See:

    • CFURLCreateBookmarkDataFromFile
    • CFURLCreateByResolvingBookmarkData
  3. Christian S

    16 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    The CFBookmarkMBS module in our plugins may help.

  4. Christian S

    16 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Or an older alias as you can get with MacAliasMBS class.

  5. Michel B

    16 Jan 2019 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 7 months ago

    Markus, just a detail, but it would make sense to move this thread to macOS...

  6. Jason P

    16 Jan 2019 Xojo Inc Answer Texas

    @Markus W The reason NOT to use AbsolutePath etc is because Mac users (unlike Windows users) expect an app to find the document even if it has been moved (for example from a RecentItems menu).

    As FSRef is deprecated how does one deal with this now? Is there a replacement that can still open moved files?

    Could FSRef still be used on HFS+ volumes and URLpath on APFS volumes?

    Please see: http://docs.xojo.com/FolderItem.GetSaveInfo
    No plugin required.

  7. Markus W

    16 Jan 2019 Pre-Release Testers #JeSuisHuman New Zealand, Auc...

    Thanks Jason and everyone!

or Sign Up to reply!