In Xojo classic you were able to create a pointer to a virtual file using e.g.
dim f as folderItem = specialFolder.documents.child(“abc”)
if you looked at the contents of f they would be there, regardless of whether the file existed. e.g. f.displayName would show “abc”.
In iOS the same doesn’t work. Calling f.displayname results in an IOException if the file doesn’t actually exist. It seems as if the you can’t have reference to a virtual file.
I would not use DisplayName for a non existing yet file anyway. Name is the actual name of the future file. DisplayName results from an interpretation of that name according to locale. It probably needs the file to exist to do its magic. At least on iOS, which is notoriously less tolerant.
What you say makes some sense, though it means we would need to check for file.exists before examining file.displayName - which seems a little heavy.
In the manual it says [quote]Under Mac OS X, use DisplayName rather than Name when displaying the name of the item to the user.[/quote] but there is equivalent comment for iOS.
So perhaps I just put it down to platform inconsistencies?
[quote=290500:@Michel Bujardet]Although they are cousins, iOS is much less tolerant than OS X.
It is not very difficult to have something that works in both instances.
Typing from XDC conference, top of my head :
function myDisplayName(f as folderItem) as Text
if f.exists then
return f.displayName
else
return f.name
end if[/quote]
Wrap that in a try-catch and you should be good to go