IOException when trying to download a new version with Kaju

macOS has become so very odd. I’m getting an IOException when downloading a new app version with Kaju.

The download file is created:

DownloadFile = SpecialFolder.UserHome
if DownloadFile <> nil and DownloadFile.Exists then DownloadFile = DownloadFile.Child("Downloads")
if DownloadFile <> nil and DownloadFile.Exists then DownloadFile = DownloadFile.Child(SelectedBinary.FileName)
if DownloadFile = nil then Return

And then the file is downloaded:

dim path as string = file.NativePath.DefineEncoding( Encodings.UTF8 )
dim f as new Xojo.IO.FolderItem( path.ToText )
super.Send "GET", url.ToText, f

The second line makes the IOException:

2021-05-30 11:22:08 Type of Error: Xojo.IO.IOException
2021-05-30 11:22:08 Error Number: 0
2021-05-30 11:22:08 Error Message: This file could not be opened

I can’t really say why the folderitem needs to be defined as utf8. The only part of the file that might be problematic is the filename.

Is this a case again of “macOS has lost access to folder xyz”? For now I’ve asked the user to restart the computer.

Does anyone have an idea what might going on here?

In the first part, you put the downloadble file into DownloadFile

DownloadFile = DownloadFile.Child(SelectedBinary.FileName)

The second part you refer to just ‘file’

path as string = file.NativePath

Code is from Kem and is not mine. But yes, I would do the same change. And perhaps do a DefineEncoding on the filename.

So far I have only one user with this problem.

I’ll have to confirm, but that first block doesn’t seem like my code. I typically don’t use one line If statements or comparisons to nil. (if x is nil then)

Yes, the first part is my own code because I download a dmg and not a zip file. Here is the original code:

dim tempFolder as FolderItem = Kaju.GetTemporaryFolder
DeleteOnCancel.Append tempFolder

DownloadFile = tempFolder.Child( SelectedBinary.FileName )