NilObjectException in Raspberry Pi folderitem code

I have an issue with folderitem failure with a NilObjectException on code I’ve compiled for the Raspberry Pi. The same code runs on a Mac without problems. It could be some detail I’ve overlooked in the Linux setup code, but I can’t figure it out. It may be a XOJO ARM compiler issue, so I’m posting it here because, frankly, I’ve tried everything I can think of to get it to work.

Details:
A network drive, ‘root’, is used for file sharing at our company.
The user ‘pi’ exists in the domain on the Windows 2008 R2 server that ‘root’ is attached to.
I mount the root drive from the pi using:

sudo mount -t cifs //[IP address]/root/Company/MessageBoard /mnt/myroot -o username=[my pi user],dom=[our domain],uid=[valid user id],gid=[group id (tried several)]

I manually enter the password when prompted by the mount command.
I can navigate to the newly mounted ‘myroot’ and to the root/Company/MessageBoard subfolder that I need access to:
cd /mnt/myroot/Company/MessageBoard
I have Read/Write/Execute permissions in the MessageBoard folder.
I have tested the ‘pi’ permissions in the folder using ‘vi’ to create a new file from the RasPi. I can create it, save it, and open/read it just fine:
vi /mnt/myroot/Company/MessageBoard/test.txt
So far, so good.
However, as soon as I try to create a folderitem object with that path, I get a NilObjectExecption. The code is as follows:

  
  //
  //  Returns a folderitem pointing to the Message Board folder (where DB and files reside)
  //  Returns Nil if root drive not found
  //
  
  Dim i, numVolumes as Integer
  dim myFolderItem as FolderItem
  
  numVolumes = VolumeCount-1
  
  For i=0 to numVolumes
    
    // Windows 
    #if TargetWin32
      // Win volumes will be “C:”, “D:”, “Z:”,etc. The mount I need could be any drive letter,
      //    so look for the Company\\MessageBoard folder within it
      try
        myFolderItem = Volume(i).Child("Company").Child("MessageBoard")
      catch err as NilObjectException
        msgbox "Error: NilObjectException. Is the drive mounted?"
        quit
      end try
    #endif
    
    // RasPi 
    #if TargetLinux or TargetARM
      try
        myFolderItem = Volume(i).Child("mnt").Child("myroot").Child("Company").Child("MessageBoard")
      catch err as NilObjectException
        msgbox "Error: NilObjectException. Is the drive mounted?"
        quit
      end try
    #endif
    
    // MacOS
    #if TargetMacOS
      try
        myFolderItem = Volume(i).Child("Company").Child("MessageBoard")
      catch err as NilObjectException
        msgbox "Error: NilObjectException. Is the drive mounted?"
        quit
      end try
    #Endif
    
    // see if this is the correct Volume (does the folderitem exist?)
    if (myFolderItem <> Nil) AND (myFolderItem.Exists) then
      return(myFolderItem)  // found it, so return folderitem
    end if
    
  Next
  
  return(Nil)  // can't locate the mounted share drive, so tell calling method we're Nil
  

The RasPi section works fine if I do:
myFolderItem = Volume(i).Child(“mnt”).Child(“myroot”)
That is, if I stop at what is mounted after the mount command, above. However, it gets the same NilObjectException if I later try:
f = myFolderItem.Child(“Company”).Child(“MessageBoard”)

I’ve also tried the Linux mount command with the entire path to the MessageBoard folder, but that also fails when I try to setup the SQLite database filename:
DB_File = MsgBoardPath.Child(“theDB.rsd”)

In the interest of brevity, I have not included many other attempts to get it to work. It is most likely something I’m doing incorrectly, but I’m out of ideas.

Thanks in advance for your advice/comments/public humiliation/etc.

Make sure you have the correct permissions to read from the mounted drive.

Yes, I have read/write/execute permissions in the target directory. I tested by creating, saving, opening, and reading a file in the /mnt/myroot/Company/MessageBoard folder from the pi.

But are you checking the IsReadable and IsWritable properties?

I was not checking it, but wrote some test code to answer your question. The short answer is, yes, IsReadable and IsWriteable are True for the MessageBoard folder. But, I have to use the Linux ‘mount’ command to mount the entire directory path to it.

I’m writing up my notes from testing yesterday to explain in better detail what I’m experiencing. I’ll post them as soon as time allows. Thanks Greg!