Not necessarily. Typically I use #if TargetDesktop and targetWeb and have two different paths. I believe the web app is nested another layer deep than the desktop.
You can easily tell what the difference is by putting a breakpoint in after f is defined and then look at the path in the variables pane. I also tend to put some defensive code in to break if something is missing:
if f = nil or f.exists = false then
break //bad paths
return
end
Depending on what I’m doing I may have to make further distinctions between Debug and non-debug with #if DebugBuild.
In this case it is unlikely that you’ll be able to use the same code for web and desktop. I would advise against storing your data next to the .app as this is not acceptable on Mac.
Store the data in your apps resources folder, you can keep it in the databases sub directory if you wish.
I have a module that makes accessing the resources folder easy, crossplatform, and future resistant when using old framework folderitems. Otherwise, the new framework provides access to the resources folder.
remember… any resource stored INSIDE the application (EXE or APP bundle) are READ-ONLY, attempts to write to these will usually break the app in some manner.
I had assumed it was a defaults database. Dave is right, so if it’s your users data then you’ll need to store it in a subfolder in SpecialFolder.ApplicationData to be writable.
This isn’t related to the rest of the thread, but it’s a pet peeve. Passing an empty string to GetFolderItem followed by a call to Child is inefficient and an anti-pattern. Just pass the “Databases” string directly to GetFolderItem.