NativePath = different path

I have Windows myself and I’ve read about the file system … recently… when looking for something else … but I don’t remember where that was!

There are plenty of Targets to add but I think these are enough for the users. Or?
My specific application is not for the old school people, the retro-folks, the vintage community… Because, if you don’t have a fairly recent computer, then so many other things will not work, so, it’s really not an option.

In this case, Win32 and/or Win64 doesn’t matter.

[code] Dim f As New FolderItem
DIM strLocalPath As String = f.NativePath

If TargetWin32 Then
strLocalPath = strLocalPath +“BackUp”
End If

If TargetLinux Then
strLocalPath = strLocalPath +“BackUp”
End If

If TargetMachO Then
strLocalPath = strLocalPath +“BackUp:”
End If

If TargetMacOS Then
strLocalPath = strLocalPath +“BackUp:”
End If

MsgBox strLocalPath[/code]

Dont do this.
In modern versions of Windows, you can’t easily write files next to the application itself.

At startup, check to see if

specialfolder.applicationdata.child("MyApp")

exists

If not, create it.

Then check if specialfolder.applicationdata.child(“MyApp”) .child(“Backup”)
exists, and if not, create it.

After that, your Backup folder can be referenced anywhere in the app using

specialfolder.applicationdata.child("MyApp") .child("Backup")

or you can create a variable called BackupFolder and set it to this value.

This code works on all platforms

don’t do path arithmetic like this!
you get bugs in your app. Hard to find bugs.

and path delimiter for Mac & Linux is “/”.

[quote=147372:@Jakob Krabbe] Dim f As New FolderItem
DIM strLocalPath As String = f.NativePath

If TargetWin32 Then
strLocalPath = strLocalPath +“BackUp”
End If
[/quote]

Jakob, no offence, but what you are doing here is akin to take apart a perfectly working clock and put it together a different way for each platform. That is pretty futile and self-defeating, when precisely Xojo spent large efforts creating a perfect, transparent and cross platform representation of paths.

You say this is not for old fashion computers, may I suggest you update your own programming style and leave behind the very passé way of handling folderitems through paths ?

f.child("backup") represents what you concocted on every platform, without all that paraphernalia.

Be easy on yourself. Trust folderitems. Pathes belong to the Dos 3 era :wink:

Thank you all for the valuable input!
I’m not the lazy one and since I recently asked a “very stupid” question on this board I was aiming to do some serious research before posting and eventually getting blocked for asking “too"much obvious stuff”…

So… before making this post, I read the filePath-related chapters in the three books as I have, reading in Internet and also the Docs. No where is this mentioned… Not that I could find! Or, I simply missed that part!

My greatest apology for bringing up such an emotional topic!!

At the moment, too much thinking is involved for me. Maybe I wait and make other things first. Thank you again for taking the time to pointing me in the right direction!!

[quote=147407:@Jakob Krabbe]
My greatest apology for bringing up such an emotional topic!!![/quote]

Please do not apologize for submitting that topic. It just so happens you were making it hard on yourself when the solution was already here. It happens to me too :wink: