[quote=373195:@Michel Bujardet]OK. I am going to simply create my save folder in Resources, as suggested by Jeff Tulin. Then I look if a folder already exists in specialFolder.ApplicationData
, and if so, I copy everything to my Resources subfolder (for people who already have the app) and got updated.
That should be transparent to the user, and to hell with stupid IT managers.[/quote]
I wouldn’t recommend this. While most users run inside an administrator account (not advised) you shouldn’t count on this. If your app is installed in Program Files, as it most likely is, then the resources will be read-only to standard users. Just like on macOS, this folder is NOT supposed to be written to, it’s just not as strictly enforced because Microsoft puts such a high value on backwards compatibility.
AppData is unequivocally the correct location, so you should keep it there for most users and only fall back to another location if there is trouble. I agree that Documents is probably the best backup location. I would do it something like
[code]Public Function ApplicationSupport() as FolderItem
Static SupportFolder As FolderItem
If SupportFolder <> Nil And SupportFolder.Exists Then
Return SupportFolder
End If
Dim BackupFolder As FolderItem = SpecialFolder.Documents.Child(“MyApp Data”)
If BackupFolder <> Nil And BackupFolder.Exists Then
SupportFolder = BackupFolder
Return SupportFolder
End If
Dim AppDataFolder As FolderItem = SpecialFolder.Documents.Child(“MyApp”)
If AppDataFolder <> Then
If AppDataFolder.Exists Then
SupportFolder = AppDataFolder
Return SupportFolder
End If
AppDataFolder.CreateAsFolder
If AppDataFolder.LastErrorCode = 0 Then
SupportFolder = AppDataFolder
Return SupportFolder
End If
End If
If BackupFolder <> Nil Then
BackupFolder.CreateAsFolder
If BackupFolder.LastErrorCode = 0 Then
SupportFolder = BackupFolder
Return SupportFolder
End If
End If
// … Honestly not sure what to do now. Return something in temporary?
SupportFolder = SpecialFolder.Temporary.Child(“MyApp Transient”)
Return SupportFolder
End Function[/code]
Though as you see at the end, I have no idea what the best option would be if even your backup location fails.