Strange result NativePath in OS X

Situation: OS X 10.11.3 and Xojo 2015R4.1

When I fill a path into FolderItem the result is very strange.

[code]Dim ConfigDbFile As FolderItem
Dim strFilepath As String

strFilepath = “/Users/paul/MyApp/MyApp.app/Contents/Resources/MyApp.cfg”
ConfigDbFile = New FolderItem(strFilePath)
[/code]
When I look into ConfigDbFile the result is totally different from what I would expect.
NativePath contains following data:

/Users/paul/MyApp/:Users:paul:MyApp:MyApp.app:Contents:Resources:MyApp.cfg

ShellPath is also wrong:

/Users/paul/MyApp/\\:Users\\:paul\\:MyApp\\:MyApp.app\\:Contents\\:Resources\\:MyApp.cfg

URLPath:

file:///Users/paul/MyApp/:Users:paul:MyApp:MyApp.app:Contents:Resources:MyApp.cfg

DisplayName and Name are correct:

/Users/paul/MyApp/MyApp.app/Contents/Resources/MyApp.cfg

Is this a bug or am I doing something wrong?

[quote=253525:@Paul Sondervan]
Is this a bug or am I doing something wrong?[/quote]
You’re doing something wrong

try adding the PATHTYPE param to new folderitem like

ConfigDbFile = New FolderItem(strFilePath, FolderItem.PathTypeNative)

http://documentation.xojo.com/index.php/FolderItem.Constructor(path_as_String,_PathType_as_Integer%3DPathTypeAbsolute)

Try something like this:

f = New FolderItem(App.ExecutableFile.Parent.Parent.Child("Resources").Child("MyApp.cfg"))

Updt: Norman beat me with another solution :slight_smile:

ConfigDbFile = New FolderItem(strFilePath)
This defaults to
ConfigDbFile = New FolderItem(strFilePath, FolderItem.PathTypeAbsolute)

On OS X pathtypeabsolute for the file in question would be more like
:Users:paul:MyApp:MyApp.app:Contents:Resources:MyApp.cfg

NOTE the : as separators NOT the Unix style /

Hence why you need to specify the PathType in the constructor

I’ve changed it into ConfigDbFile = New FolderItem(strFilePath, FolderItem.PathTypeNative).
Now I get the correct results.
Thanks for pointing me in the right direction Norman.