Quantcast
Viewing all articles
Browse latest Browse all 3852

TextInputStream Empty?

Am I doing something stupid here? I cannot fathom out why ReadAll doesn’t retrieve anything. The file exists, it’s length is also reported under FolderItem. I am running this on Ubuntu, and if i ‘cat’ the file as a standard user the the content is displayed.

The code executes without error, byt strMTAB is empty.

Var f As FolderItem
Var strMTAB As String

If TargetLinux Then
  
  f = New FolderItem("/etc/mtab", FolderItem.PathModes.Shell, False)
  
End If


If f.Exists = True Then
  
  Var t As TextInputStream
  
  Try
    
    t = TextInputStream.Open(f)
    t.Encoding = Encodings.UTF8
    strMTAB = t.ReadAll
    t.Close
    
    If strMTAB.IndexOf(frmMain.SFTPDestinationServer) > 0 Then
      
      Return True
      
    Else
      
      Return False
      
    End If
    
  Catch e As IOException
     
     t.Close
     MsgBox("Error accessing file.")
     
  End Try
  
End If

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3852

Trending Articles