My program allows the user to select any number of ‘datafiles’ they would like to use within the program but I don’t want to store the actual files in the sqlite database I use on the backend.
I could obviously store the file path of these datafiles but if they are subsequently moved to a different location this will not work.
Is there a way to store an alias of the datafile instead or some form of pointer to the file?
The basic problems with links… As the files they are pointing to tend to get maintained, moved or deleted any link in a dynamical environment is a problem. Ofcourse you can store the aliases but it won’t solve your broken link problem.
An alias IS a link to a file.
How big are your datafiles anayway. Have you tried storing them in the database and measuring the performance? I store up to 50 MB’s in a SQLite database without any problems with performance.
I didn’t want to store them in the database because it’s possible the files could be edited/changed outside of my program.
I may just have to store the path and perhaps a hash of the file which can then be compared when my program is launched.
If the file is moved by the user from it’s original path then I could just prompt them to re-select it.
[quote=139925:@Paul Finer]My program allows the user to select any number of ‘datafiles’ they would like to use within the program but I don’t want to store the actual files in the sqlite database I use on the backend.
I could obviously store the file path of these datafiles but if they are subsequently moved to a different location this will not work.
Is there a way to store an alias of the datafile instead or some form of pointer to the file?
Alternatively for OS X, you can use a bookmark, in fact if you’re considering the App Store, you’ll need to use a Security-Scoped Bookmark.
Just like SaveInfo in Xojo, these store information that enables the OS to reconnect to the file after it’s been moved or renamed, unlike a path or relative link.
[quote=140009:@Paul Finer]Great, looks like that will do the trick.
Just thought I’d point out that there are a couple of grammatical errors on that linked page.
[/quote]
Did you report them in feedback ?
Please do so
Sam, thanks for the bookmark info, I’ll do some research on that even though I’m not intending to sell via the App Store.
Norman, I’ll file a feedback report for that page.
Thanks
When in doubt file a report otherwise you never know if someone already has or not
And if no one has then its unlikely we’ll know about it to fix it
Actionable reports are the best as they clearly describe the problem, how it can be reproduce & symptoms
This one should be easy since you can copy paste & highlight the bad grammar