# GetSaveInfo Rare Fail

**URL:** <https://forum.xojo.com/t/getsaveinfo-rare-fail/13469>\
**Category:** General\
**Created:** [January 7, 2014, 11:53am UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469 "2014-01-07T11:53:12Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [January 7, 2014, 11:53am UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/1 "2014-01-07T11:53:12Z")

</div>

My Mac/PC app remembers the last document opened and reloads it on launch. Rarely, but on a regular basis, the app will be unable to construct a FolderItem from the GetSaveInfo causing user panic when they think their document has gone.

I get the save info via

`theSaveInfo = theFolderitem.GetSaveInfo(nil, 0)
  theSaveInfo = EncodeBase64(theData, 0)`

and store it in a preferences file. I retrieve it via

` dim theFolderItem as FolderItem
  theFolderItem = GetFolderItem(DecodeBase64(theSaveInfo)) // theFolderItem = nil on fail
`

Here’s an example of a SaveInfo that won’t reconstruct (base64 encoded) APHRcwECAQAAAAFEAAAAAAFEAAIAAA1MaXR0bGUgT3JhbmdlAAAAAAAAAAAAAAAAAADNClnWSCsAAAAAAAIJZGVsbWUub3RkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT3tM7nR1Z0ZXh0T0ZUTf

(I assume there’s no way to extract the path from a SaveInfo that won’t reconstruct. )

Anyone think of anything obvious?

---

<div class="post-metadata">

**Author:** ![Joseph\_Morgan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@Joseph\_Morgan](https://forum.xojo.com/u/Joseph_Morgan)\
**Post date:** [January 7, 2014, 12:53pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/2 "2014-01-07T12:53:49Z")

</div>

I have been using GetSaveInfo for the first time recently and since then, I have used it a ton and have had no issues. But I’m saving mine into an SQLite database table without messing with encodings. Also I use GetRelative to open the file but I’m not sure why or how it works because I copied the code from one of the examples and never looked back.

---

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [January 7, 2014, 1:40pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/3 "2014-01-07T13:40:37Z")

</div>

Thanks!  
I tried the GetRelative instead of GetFolderItem without effect.

---

<div class="post-metadata">

**Author:** ![Joseph\_Morgan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@Joseph\_Morgan](https://forum.xojo.com/u/Joseph_Morgan)\
**Post date:** [January 7, 2014, 2:50pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/4 "2014-01-07T14:50:40Z")

</div>

Is it only certain folders that cause it to fail?

---

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [January 7, 2014, 3:34pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/5 "2014-01-07T15:34:11Z")

</div>

Alas, I don’t know because I can’t read the SaveInfo. I’ll start saving the path separately for debugging.

---

<div class="post-metadata">

**Author:** ![Roger\_Clary](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/eada6e/32.png) [@Roger\_Clary](https://forum.xojo.com/u/Roger_Clary)\
**Post date:** [January 7, 2014, 4:11pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/6 "2014-01-07T16:11:14Z")

</div>

> [@](#):
>
> …because I can’t read the SaveInfo

From the LR…  
“NOTE: The returned string is not intended to be human-readable and any modifications may render it useless.”

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [January 7, 2014, 4:22pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/7 "2014-01-07T16:22:02Z")

</div>

[quote=57628:@Roger Clary]From the LR…  
“NOTE: The returned string is not intended to be human-readable and any modifications may render it useless.”[/quote]

You can, however look at the data and get some clues.

Your base64 string decodes as follows:

```auto
echo 'APHRcwECAQAAAAFEAAAAAAFEAAIAAA1MaXR0bGUgT3JhbmdlAAAAAAAAAAAAAAAAAADNClnWSCsAAAAAAAIJZGVsbWUub3RkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT3tM7nR1Z0ZXh0T0ZUTf' | base64
```

gives a binary string which includes some human-readable text:

```auto
ÒsDD
Little OrangeÕ
Y÷H+	delme.otd¥ÁGVtextOFT
```

Does that provide any clues? I believe this means the file creator is ‘OFT’ and the file Type is ‘text’. The file name may be “Little Orange” (or perhaps this its he volume name?) and there’s something called “delme.otd”. I wonder if “delme” stands for “Delete Me” and could possibly be a file or folder that was trashed?

---

<div class="post-metadata">

**Author:** ![Joseph\_Morgan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@Joseph\_Morgan](https://forum.xojo.com/u/Joseph_Morgan)\
**Post date:** [January 7, 2014, 4:40pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/9 "2014-01-07T16:40:51Z")

</div>

> [@57631:@Michael Diehr](#):
>
> Does that provide any clues? I believe this means the file creator is ‘OFT’ and the file Type is ‘text’. The file name may be “Little Orange” (or perhaps this its he volume name?) and there’s something called “delme.otd”. I wonder if “delme” stands for “Delete Me” and could possibly be a file or folder that was trashed?

Or is it possible the file was simply moved by your users to some other directory and they are expecting your application to know when they move it from the original directory? But of course if you as the developer are testing this on your computer, you as the developer know when you moved it. Is this being reported only by your users or have you been able to reproduce the failure on your computers as well?

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [January 7, 2014, 4:48pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/10 "2014-01-07T16:48:43Z")

</div>

> [@57635:@Joseph Morgan](#):
>
> Or is it possible the file was simply moved by your users[…]

The reason to use GetSaveInfo in the first place is that, in most situations, it will accurately track a file that has been moved (it does this by tracking the file’s ID on disk, rather than the file’s name and path). Of course, there are some situations where it won’t work: if the file is Deleted, or is on a Volume that is not mounted, etc.

---

<div class="post-metadata">

**Author:** ![Joseph\_Morgan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@Joseph\_Morgan](https://forum.xojo.com/u/Joseph_Morgan)\
**Post date:** [January 7, 2014, 5:03pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/11 "2014-01-07T17:03:43Z")

</div>

Michael, that’s good stuff to know.

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [January 7, 2014, 5:15pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/12 "2014-01-07T17:15:51Z")

</div>

> [@57636:@Michael Diehr](#):
>
> The reason to use GetSaveInfo in the first place is that, in most situations, it will accurately track a file that has been moved (it does this by tracking the file’s ID on disk, rather than the file’s name and path). Of course, there are some situations where it won’t work: if the file is Deleted, or is on a Volume that is not mounted, etc.

Is that true on Window or just OS X?

- Karen

---

<div class="post-metadata">

**Author:** ![Joseph\_Morgan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@Joseph\_Morgan](https://forum.xojo.com/u/Joseph_Morgan)\
**Post date:** [January 7, 2014, 5:17pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/13 "2014-01-07T17:17:55Z")

</div>

> [@57644:@Karen Atkocius](#):
>
> Is that true on Window or just OS X?

I wonder that myself as I am confused by the reference text:

“Allows saving FolderItem references without relying on the absolute path.  
The returned string indicates a relative path with is relative to the folder passed in RelativeTo. You may pass nil to indicate that you do not care for a relative resolution of the path (this is, for instance, still useful on OS X where renamed and moved files can still be found with the FolderItem.GetRelative function nonetheless).”

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [January 7, 2014, 11:16pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/14 "2014-01-07T23:16:05Z")

</div>

Which platform re you seeing it fail on ?  
On OS X the nay reason I can think of that it would fail is the volume the item was on is not present any longer.  
Other than that the data is basically an alias - so it should find it even if its been moved.

On Windows & Linux however there’s nothing like an alias so it basically relies on an absolute path name.  
if its moved or renamed then you still won’t find it.

---

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [January 8, 2014, 11:05am UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/15 "2014-01-08T11:05:02Z")

</div>

It seems to happen on both platforms. I’m going to assume user error for the moment and store the path separately for debugging purposes to see if I can get more clues. I appreciate everyone’s follow up.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [January 8, 2014, 5:53pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/16 "2014-01-08T17:53:36Z")

</div>

On rare occasions, I’ve seen a case where OS X will mis-identify a file when using this technique. I believe it only happens after something major happens (e.g. your hard drive crashes and you have to restore from a backup). You can end up with one “File ID” which points to the wrong file. Very bizarre when it happens.

To protect for this, I added some code which, after restoring a folderItem, checks to see that the .Name is the same as the we expected.

I’ve never seen this happen on Windows, just OSX.

---

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [January 9, 2014, 2:46pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/17 "2014-01-09T14:46:34Z")

</div>

Interesting. I’ll add some sanity checking and see what happens.

---

<div class="post-metadata">

**Author:** ![Stephen\_Dodd](https://forum.xojo.com/user_avatar/forum.xojo.com/stephen_dodd/32/530_2.png) [@Stephen\_Dodd](https://forum.xojo.com/u/Stephen_Dodd)\
**Post date:** [June 24, 2016, 2:05pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/18 "2016-06-24T14:05:00Z")

</div>

FYI, years later, I have discovered why storing GetSaveInfo sometimes fails.

1. Save file to remote drive or network disk. Remember path in a FolderItem.

2. Disconnect remote drive temporarily.

3. Try to extra SaveInfo from FolderItem representing the remote drive. Save that to disk.

4. Restart app with drive now connected. GetSaveInfo no longer points to a valid location.

Basically if FolderItem does not exist when you extract GetSaveInfo from it, the string won’t be valid.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:00pm UTC](https://forum.xojo.com/t/getsaveinfo-rare-fail/13469/19 "2020-10-29T17:00:56Z")

</div>


