preferences and path

Hi all :slight_smile:

i’ve got som weird problem with xojo. I use the PreferencesExample from https://blog.xojo.com/2014/01/27/saving-preferences/ to save things fine in JSON. I wrote such a thing for synoSync on my own but this has is a bit better.

so i save a path with it… like this:

Preferences.wowpath = f.NativePath f = f.Child("interface").Child("addons") Preferences.addonpath = f.NativePath

On windows this looks like this:

""addonpath":"E:\\\\Games\\\\World of Warcraft\\\\interface\\\\AddOns\\\"

Dunno why there are \\ instead of \ but it seems to work. On MacOS i got something like this:

"addonpath":"\\/Applications\\/World of Warcraft\\/Interface\\/Addons"

This seems to be wrong somehow, if i use the kaju zipshell to decrompress something to this folder… windows works fine but osx seems to do nothing, but there its no error.

If look at this at the msgbox… i get this:

This seems wrong for me?

I got a file not found there:

https://xojo.io/40c7ec68b03a

I found a copy in my local hard disk that dates from last july.

Edit:
I get an eye on the example, but I do not understand…anything (I understand nothing).

Is there’s invisible stuff in the project that - for example - deals with JSON ?

Edit 2:
The project have been created for BuildCarbonMachOName for macOS.

Dunno what you mean, but the download seems to be broken. This ist just a module, do you need a project with it?

Sasha:
No: I have the project (that have the module inside).

App have two events (Open + Close),
Window1 too + two Labels and a TextField.

I wanted to help, but I cannot, sorry.

even i got the same

is this a xojo bug with nativepath or a bug with the file?

whis is the whole thing:

[code] Dim f As FolderItem
f = dlg.ShowModal
If f <> Nil Then

	      Dim checkfile as FolderItem
	      checkfile = f
	      checkfile = checkfile.Child("wow.exe")
	      
	      If checkfile.Exists = False Then
	        MsgBox  "World of Warcraft was not found in this folder!"
	        Quit
	      else
	        Preferences.wowpath = f.NativePath
	        f = f.Child("interface").Child("addons")
	        Preferences.addonpath = f.NativePath
	      End If[/code]

(This board need a useful syntax highlighting plugin…)

I would shorten that

[code]Dim f As FolderItem
f = dlg.ShowModal
If f <> Nil Then

Dim checkfile as FolderItem
checkfile = f
checkfile = checkfile.Child(“wow.exe”)

If checkfile.Exists = False Then[/code]

to

[code]Dim f As FolderItem
f = dlg.ShowModal
If f <> Nil And f.Exists Then
Dim checkfile as FolderItem = f.Child(“wow.exe”)

If not checkfile.Exists Then
…[/code]

From my preference class:

It is best to save a FolderItem as => EncodeBase64( FolderItem( Value ).[b]GetSaveInfo/b )
To restore it: => GetFolderItem( DecodeBase64( inValue ))

Ok i will try that :slight_smile: thank you

[quote=296698:@Sascha Mierke]Preferences.wowpath = f.NativePath f = f.Child("interface").Child("addons") Preferences.addonpath = f.NativePath[/quote]

Try something like
ff=getFolderItem( f.Child(“interface”).Child(“addons”),FolderItem.PathTypeNative)

If I don’t do the ,FolderItem.PathTypeNative) part, I see the same result as your screenshot above,
mixing the folderitem in request with the application’s own path.

Probably use two different Folderitem variables as well, to not mix the f=f.child variable,
using “Preferences.wowpath = f.NativePath” with a temporary folderitem variable, to be used within that method only.

this ff=getFolderItem( f.Child(“interface”).Child(“addons”),FolderItem.PathTypeNative) isnt really working. I tried the encodebase from @James Dooley … this is working on MacOS now, just a bit ugly in a configfile.