Hello Everyone,
Is there a limit to the folderitem path length on the Raspberry Pi?
I am wanting to copy a file from a directory to the desktop but the nativepath seems to remove portions of the FolderItem path. Below is a Screen Grab from the Raspberry Pi B 2, where the starting directory is /sys/bus/w1/devices. The program searches for the next subdirectory which begins with the string ‘28-’ and then moves to this directory. This is where the issue happens. The string is correct with the path /sys/bus/w1/devices/28-00000620c1c9, but the folderitem path f = /sys/bu/devices/w1_bus_master1/28-00000620c1c9 is incorrect, as it is missing the s/w1/ portion of the path.
Here is the ‘Pi String’ pushbutton code for this example (sorry for the spaghetti code)
[code] Dim FString, TempString as String
FString = “/sys/bus/w1/devices”
Dim f as FolderItem
f = New FolderItem(FString, FolderItem.PathTypeShell)
Listbox1.AddRow "f.NativePath = " + f.NativePath
If f <> nil then
if f.Exists then
Listbox1.AddRow "current directory: " + f.NativePath
Dim FCount, i,j as Integer
FCount = f.Count
For i = 1 to FCount
If InStr(f.Item(i).Name, “28-”) > 0 Then
FString = FString + “/” + f.Item(i).Name
f = GetFolderItem(FString)
Listbox1.AddRow "f = " + f.NativePath + ", FString = " + FString
Listbox1.AddRow "TryFolderCount = " + CStr(f.Count)
If f <> nil then
If f.Child(“w1_slave”).Exists then
FString = FString + “/” + “w1_slave”
f = New FolderItem(FString, FolderItem.PathTypeShell)
Listbox1.AddRow "w1_slave exists: " + f.NativePath
Dim MyCopy as FolderItem = SpecialFolder.Desktop
f.CopyFileTo MyCopy
Else
Listbox1.AddRow “The subdirectory does not exist”
End If
Else
Listbox1.AddRow “The subdirectory is nil”
End If
End If
Next
Else
Listbox1.AddRow “The directory does not exist”
End if
Else
Listbox1.AddRow “The directory is nil”
End If[/code]
Here is the download link to the example program: Example9-1b. The Windows code works well, but the ‘Pi String’ pushbutton code does not work.
Thanks for your thoughts and advice.