FolderItem is nil in 2013R2 but OK in 2012R2.1

I have been working on a web app in 2012R2.1. I am still trying to get used to Xojo and felt confident enough today to move the project to Xojo. The first time I tried to run it, a routine that has worked for months failed. The routine is supposed to open an html file in a TextInputStream and display it in an HTMLViewer. For some reason, f returns a folderitem in RS, but a nil in Xojo. I thought it might be a Windows firewall issue as a warning pops up before running the debugger iwth Xojo and it didn’t with RS, but the same thing happens with the firewall turned off.

[quote] dim fileName, path As String

#if DebugBuild
path = GetFolderItem("").Parent.Child(“help”).AbsolutePath + “”
#else
path = GetFolderItem("").Child(“help”).AbsolutePath
#endif

if done1 = d.Count Then
fileName = “wizDone.html”
Else
fileName = d.Value(d.key(done1)) + “.html”
end if
dim f As FolderItem = GetFolderItem(path+fileName)
dim t As TextInputStream = TextInputStream.Open(f)
'dim t As TextInputStream = TextInputStream.Open(GetFolderItem(path + fileName))
[/quote]

Dont build up a string as a path just to open it
You really dont need to and that is probably the source of the problem since you dont tell “GetFolderitem” what type of path you’ve built

try something more like

[code]if done1 = d.Count Then
fileName = “wizDone.html”
Else
fileName = d.Value(d.key(done1)) + “.html”
end if

dim f As FolderItem

#if DebugBuild
f = GetFolderItem("").Parent.Child(“help”).Child(fileName)
#else
f = GetFolderItem("").Child(“help”).Child(fileName)
#endif

if f <> nil then
dim t As TextInputStream = TextInputStream.Open(f)
end if
[/code]

I copied Norman’s code into my app and f is still nil in Xojo while RS returns a folderitem with the absolute path =[quote]C:\Users\Dean\Documents\Real Projects\MiniCloud\help\wizUsers.html[/quote]

It appears that Xojo does not like GetFolderItem("") because when I changed[quote]f = GetFolderItem("").Parent.Child(“help”).Child(fileName)[/quote] to [quote]f = SpecialFolder.Documents.Child(“Real Projects”).Child(“MiniCloud”).child(“help”).Child(fileName)[/quote] it worked. I will file a bug report.

I’m curious what the difference is with GetFolderItem("").

What does MsgBox(GetFolderItem("").AbsolutePath) show in your version of Real Studio and in Xojo?

Is it possible you have “Use Build Folders” off in one and on in another?

“Use Build Folders” was the problem. It was off in Xojo and on in RS. I had assumed that Xojo would have picked up that value from the rsd file when I opened it. Guess not.