Folder name length limit

I just stumbled into an interesting limitation in the name of a folderItem.CreateAsFolder.

I had an issue with creating a subfolder in ApplicationData. It never worked. I suspected all sorts of things, especially some sort of new permissions in the current 10.11.4 beta version of EC. Well, it finally dawned on me the rather long name I had picked for the app ID could be the problem :

com.matchsoftware.managerfordingbatfonts

When I changed to com.matchsoftware.mfdf it worked immediately

So I created a small test app as such :

dim f as folderitem = SpecialFolder.UserHome.Child("Downloads") dim g as FolderItem dim nom as string = "com.matchsoftware.mana" for i as integer = 0 to 9 g = f.child(nom) g.CreateAsFolder nom = nom+str(i) next

Well, the result is that the last folder to be created was com.matchsoftware.mana012345678.

So, in practice, the longest name for a CreateAsFolder appears to be 31 characters.

feedback://showreport?report_id=42130

That was the case in Mac OS, long time ago. (in fact, for folders, the limitation was 29 chars in Mac OS X before 10.0).

May it be the com.<something> length that is limited to 31 characters ?

[quote=240656:@Emile Schwarz]That was the case in Mac OS, long time ago. (in fact, for folders, the limitation was 29 chars in Mac OS X before 10.0).

May it be the com.<something> length that is limited to 31 characters ?[/quote]

Even if the app ID was limited in length it would have nothing to do with this issue. It is the folder name that has the issue. I could have chosen any other combination of characters.

the limit was 31 chars with old FSSpec APIs.
But those should no longer be used in Xojo.

[quote=240661:@Christian Schmitz]the limit was 31 chars with old FSSpec APIs.
But those should no longer be used in Xojo.[/quote]

Could be simply something never noticed before…

[quote=240661:@Christian Schmitz]the limit was 31 chars with old FSSpec APIs.
But those should no longer be used in Xojo.[/quote]

They aren’t and haven’t been for years.

Michel,

I used the code below (from yours):

dim f as folderitem = SpecialFolder.UserHome.Child(“Downloads”)
dim g as FolderItem
dim nom as string = “com.matchsoftware.mana_leplusbeaudumondecestluiouellecadepend”

g = f.child(nom)
g.CreateAsFolder

and I get the right folder.

In the debugger, g exists and is not Nil, in the Downloads folder, I get that new folder.

There may be some sort of permission issue on OSX. I had a similar problem, wasn’t able to do CreateAsFolder on SharedApplicationData but had no problems when using ApplicationData instead. Trying to catch error as IOexception did not return anything.

I do know at one time (still?) Unix had a 31 character limitation… as a matter of fact I know that the AIX computers at my previous employer had this limitation, as I had to get creative with some naming conventions to keep them under 31 characters

try deleting com.apple.finder.plist

I don’ t think SharedApplicationData is directly accessible. I always used ApplicationData anyway.

https://forum.xojo.com/8085-write-to-sharedapplicationdata/0