Getting there… I am having issues with file access. I do this:
f = New FolderItem("/home/pi/Pipes_User_Library", FolderItem.PathModes.NativePath)
f then is not Nil, but it says it does not exist. The client says he is sure the path exists and that it is 777. Is there something wrong with my call?
I am trying to run a simple program on my Raspberry Pi with Xojo 2020 r1.1 and I am getting the following error:
An exception of class IOException was not handled. The application must shut down. Exception Error Number: 2
I made a text file called Hello and in the file I added a row of text called Hello World
Here is my code:
Sub Action() Handles Action
Var FString as String
FString = "/home/pi/Pipes_User_Library"
Var f as FolderItem
f = New FolderItem(FString, FolderItem.PathModes.Shell)
f = f.Parent.Child("Hello")
If f <> Nil Then
Var MyText as TextInputStream
MyText = TextInputStream.Open(f)
Label2.Text = MyText.ReadAll.ToText
MyText.Close
Else
MessageDialog.Show("f <> Nil error")
End If
End Sub
I am unable to use FolderItem.PathModes.NativePath as it won’t compile.
Not sure what to say, but something is wrong. I tried some other folderitem examples and am getting errors.
Thanks for the comment. Yep, I did consult the docs and saw that the term Native is used. I don’t know if there is a discrepancy on the website or if there is an issue with 2020 r1,1?
Maybe you want to try this in order to get more clues about if you can reach that file after all (i.e. creating a valid instance from the “Hello” child on the Parent directory for the Folderitem pointed by the provided path, right permissions, etc.):
Does the “Hello” file exists and it has some kind of file extension not included?
Sub Action() Handles Action
Var FString as String = "/home/pi/Pipes_User_Library"
Var f as FolderItem
Try
f = New FolderItem(FString, FolderItem.PathModes.Native)
f = f.Parent.Child("Hello")
Var MyText as TextInputStream = TextInputStream.Open(f)
Label2.Value = MyText.ReadAll
MyText.Close
Catch e as IOException
MessageBox e.Message
End Try
End Sub
Native is definitely right and NativePath wrong and it doesn’t compile. My guess is you had it right but somehow copied it wrongly into your OP, when you were talking about f not being Nil but f.exists being false. Looking here at my code, testing with NativePath, and looking at the doc I see no inconsistency.
Nobody really answered my question, but your discussion was educational anyway. My client got it figured out, I really was doing the right thing. I just thought there was some secret stuff regarding ARM.