I’ve to find the exact path of a file (database) saved into a network drive (in User/Library/Application Support) so that i can access to that database.
Using this code:
[code]Var f As New FolderItem
f = FolderItem.ShowOpenFileDialog("???")
If f.URLPath <> “” Then
MessageBox(f.URLPath)
Else
MessageBox(“The URLPath is null”)
End If[/code]
I cannot see the Library directory (i’m on a Mac)
How to achieve that ?
Btw why when f is nil the app crashes ?
Btw why when f is nil the app crashes ?
Read the LR to learn about howto avoid that (FolderItem).
You will also find in the same page an answer for your main question (look around SaveInfo).
Hi @Fabrizio Cesare
In this line of code: If f.URLPath <> "" Then
you are accessing the URLPath
property without checking before If the variable f
stores a valid object reference; that is, you’re assuming here that f
got a proper FolderItem object from the previous line
but it may not be the case.
For example, you can rewrite it as follows:
[code]Try
Var f As New FolderItem
f = FolderItem.ShowOpenFileDialog("????")
If f <> nil and f.URLPath <> “” Then MessageBox(f.URLPath)
Catch e as IOException
MessageBox e.message
End Try[/code]
In order to access the user Application Support folder, you can try something like this:
Var f as FolderItem = SpecialFolder.ApplicationData.Child("YourFileName")
and to access the shared Application Support Folder, then you can use something like this:
Var f as FolderItem = SpecialFolder. SharedApplicationData.child("YourFileName")
This is some information you can find here.