Using TextOutputStream.Create on Windows results in errno 3 with no further info

Hi Folks,

Working with a Windows build where the common user info is stored in C:\ProgramData\TOLIS Group\AppName

When I try to create a preferences entry file in the hierarchy’s etc subfolder (which does exist), I’m getting a valid FolderItem from GetFolderItem, but attempts to create the file result in an errno 3 with no further info. The IsReadable and IsWriteable properties are bot true.

I’m using a call that works on Linux and OS X:

TextOutputStream.Create(f)

Again f is not Nil, and IsWriteable is true.

I’ve checked MSDN docs for errno 3, but it’s definitely not a “No such process” error.

Any other ideas?

Windows error codes are different from C errno codes. Windows error 3 is “Path not found”. This typically means that a parent directory in the path doesn’t exist. Verify that the FolderItem is pointing to the path you’re expecting.

Thanks, Andrew, but while it appears that the path I’m asking for exists, when I try to create the file, the TextOutputStream.Create is getting hosed by spaces in the path name. The path being:

C:\\ProgramData\\TOLIS Group\\AppName\\etc\\com.tolisgroup.appname

After running and failing, the result is a 0 byte file in C:\ProgramData named “TOLIS”.

So, it seems that the Windows errno 3 is correct, the problem is the way that Xojo is trying to create the file.

Dunno why you’re seeing that
Here Windows 10 this code creates the hierarchy just as I expect

		dim f as folderitem
		
		f = SpecialFolder.SharedApplicationData
		
		if f is nil then break
		if f.exists = false then break
		
		f = SpecialFolder.SharedApplicationData.child("foo bar")
		
		if f is nil then break
		if f.exists = false then break
		
		f.CreateAsFolder
		
		if f is nil then break
		if f.exists = false then break
		
		f = f.child("AppName")
		
		if f is nil then break
		if f.exists = false then break
		
		f.CreateAsFolder
		
		f = f.child("etc")
		
		if f is nil then break
		if f.exists = false then break
		
		f.CreateAsFolder
		
		f = f.child("com.tolisgroup.appname")
		
		if f is nil then break
		if f.exists = false then break
		
		f.CreateAsFolder
		

Ugh - found it. The PowerShell script I use to create the hierarchy had the parent folder named “TOILS Group” Looks like the spell check in Wordpad got me. (TOILS instead of TOLIS)

Yay ! Closed not a bug :stuck_out_tongue: