Getting the complete Path to a file with volume name

I am trying to get the complete file location, I am getting what looks like the display path without the drive volume in the path, I have tried all the combinations I could find that the Wiki lists and none of them will give me the absolute path. ie Macintosh Drive:pathtofile or on Windows ie C:\pathtofile

I removed some unnecessary code from the post, but here is the part that allows the user to select a folder to import from. Then finds all the text files with .txt as an extension in the folder. Not sure what I am missing here

dim whattofind,name As String
dim folderelement,singlefile as FolderItem
dim i,p,howmanyitems,clength as Integer


Dim dlg As New SelectFolderDialog
Dim f As FolderItem
dlg.ActionButtonCaption = "Select Folder"
dlg.Title = "Import Folder"
dlg.PromptText = "Select Folder To Import From"
#If Not TargetLinux Then
  dlg.InitialDirectory = SpecialFolder.Documents
#Else // open Home directory on linux
  dlg.InitialDirectory = SpecialFolder.Home
#Endif
f = dlg.ShowModal


If f <> Nil Then
  

  WhatToFind = ".txt"
  FolderElement = f
  
  If Not(FolderElement Is Nil) Then
    HowManyItems = FolderElement.Count
    For I = 1 To HowManyItems
      SingleFile = FolderElement.Item(I)
      If SingleFile <> Nil Then
        Name = SingleFile.Name
        P = InStr(Name, WhatToFind)
        If P > 0 Then
          
          listbox1.AddRow FolderElement.Item(I).NativePath.ToText
          
        End If
      End If
    Next I
  End If
  
Else
  // user cancelled
End If

[h]Do not use AbsolutePath, you need to use NativePath instead.[/h]

On Mac, if the file is on the main drive you’ll get a path like /Users/you/Desktop/path.txt and if it’s on an external you’ll get /Volumes/Work Drive/Documents/path.txt

I don’t know what it would look like on Windows though.

Here I ran your code, selected a network share, and get

 \\\\psf\\Home\\Desktop\\RB Test Projects\\reporting in 64 bit\\future.txt

which is the absolute path (including volume \\psf )
If instead I pick a dir on my C drive I get

C:\\Users\\IEUser\\Documents\\future.txt

When I run this on OS X I also get the correct path
Note that because OS X a Unix variant things are mounted at different places so this one IS correct and may NOT include a “volume” becuase of where this device is mounted

/Users/npalardy/Desktop/RB Test Projects/reporting in 64 bit/future.txt

When I select something that IS on a different volume - not the boot hard drive - I again get the correct full path

/Volumes/10.12/Users/npalardy/Desktop/future.txt

So… the code is correct, wonder why I am not getting the text file to load using it. Thanks guys

Do you mean you’re not able to read the text file into a TextInput or BinaryStream?
Or do you mean they’re not showing up in the listbox?

[quote=342831:@Tim Parnell]Do you mean you’re not able to read the text file into a TextInput or BinaryStream?
Or do you mean they’re not showing up in the listbox?[/quote]

I just started a new thread, since I know now the code I was using is correct for the complete path, the issue seems to be loading it as a text input stream. I see the file name & path is correct but I am getting the file doesn’t exist. So I am screwing something up somewhere… :frowning: