File FolderItem doesn't ??? exist

I only added some code for Linux in TPFS.
The Folders you use in TPSF do not have problems in Linux, they cannot be localized.

That only affects Folders like Documents, Music, Pictures …

Ah okay. I’ll have a look later!
Thank you for helping with Linux support :slight_smile:

I double checked my code and rewrote names to make things clear. I added comments in case the viewer needs clarification.

My problem still existed. “PrefsFile” still couldn’t be found in the folder.
Then tested with a beep to see if the folder from the stored path equaled the path generated the suggestion of delineating SpecialFolders by Jeff Tullin. It beeped.
The 2 paths even though they have the exact same characters aren’t the same.

I then decided that since I had stored the name of just the folder (Base for this one) to use that.

So the relative lines are

Databasefolder = Datafolder.child("Base") prefsfile = Databasefolder.child("Prefsfile")

I can now cut out that piece stored data and some code no longer needed.

Yes, but how do you set up Datafolder?
If you are using a path, or GetFolderitem, you still have the problem.

Datafolder must be defined using Specialfolder.something to begin with.

prove it easily:
Create a folder called base on your desktop
Put a file called prefsfile in that

then

Databasefolder = specialfolder.desktop.child("Base") prefsfile = Databasefolder.child("Prefsfile")

mainfolder = Specialfolder.Documents.child("Basic Programming") reviewcardsfolder = mainfolder.child("ReviewCards") Datafolder = reviewcardsfolder.child("Data")
Yes. That helped tremendously. Using this system I eliminated the storing of those paths. I was getting lost in the setup, and that was just what I needed. For some reason, I was thinking they were more attributes from the OS than both a folderitem and a property. And yes they are now properties.

I would not use Specialfolder.Documents. You can get problems in some OS.

Tim’s TPSF has everything you need.

dim mainfolder as FolderItem = TPSF.AppSupport
if not mainfolder.Exists then mainfolder.CreateAsFolder

[quote=318547:@Axel Schneider]I would not use Specialfolder.Documents. You can get problems in some OS.

Tim’s TPSF has everything you need.

dim mainfolder as FolderItem = TPSF.AppSupport if not mainfolder.Exists then mainfolder.CreateAsFolder [/quote]
Thanks Axel. I agree. One of the new (since 2005) problems is Specialfolder. It used to be I could store everything in Documents (at least Windows). I would also assume that we programmers develop our code in Documents. So the question is my program is under Documents but what should I do with this info and AppSupport?
http://developer.xojo.com/xojo-io-specialfolder$ApplicationSupport doesn’t explain it any better. Sorry for being too brief and I hope you can read where I’m going.

Your app is in ‘Documents’ ?

Apps should be in ‘Applications’ on Mac or in ‘Program Files’ on Windows.

Specialfolder.ApplicationData is ‘/Users/UserName/Library/Application Support’ on Mac

and ‘\Users\UserName\AppData\Roaming\’ on Windows.

dim mainfolder as FolderItem = TPSF.AppSupport if not mainfolder.Exists then mainfolder.CreateAsFolder

creates a Folder with the name of your app in Specialfolder.ApplicationData where you can create your subfolders and store your files

reviewcardsfolder = mainfolder.child("ReviewCards") if not reviewcardsfolder.Exists then reviewcardsfolder.CreateAsFolder Datafolder = reviewcardsfolder.child("Data") if not Datafolder.Exists then Datafolder.CreateAsFolder

You can understand my confusion. I am probably writing the code in Documents still. Who moves it to that folder? I assume me. It’s probably in a debugging folder, Correct? So is that data not erased when I close it out.
Also, do I save my code Programs Files in WINDOWS?
If Tim’s code does all this I’m happier.

This was somewhat misleading.
When you wrote ‘my program is under Documents’ I thought you mean your compiled app.
But if you mean your Xojo Project, you can store that wherever you want.

Cool. Thanks. I have known programs to actually save my data under Program Files. I haven’t seen it in years but…

He does.
The trouble THERE is expecting what works while debugging to work when deployed.
So if the debug app is running in Documents (no problem with that), and looking in documents (local to the app) for files, hey it (usually) work when debugging.

But when deployed, the app will not be there.
And the files wont be local to it any more.

So when deployed, the files need to be in Specialfolder.applicationdata
And then the program will work when installed wherever it needs to be.

Its a bit like looking for money in your pocket (local to you) , as opposed to getting money from a bank (which is a known location, and doesnt move, no matter where you go)

Jeff. I did get Axel’s point. While developing it doesn’t matter where I keep the stuff while I’m developing.
I am only confused about how preferences and stuff gets into AppData/Roaming. I assume when I install it the installer does that.
I also am confused about all of the terminology extra to programming. I hope there are resources in XOJO for that.
I also appreciate your TPSF module.

You have to specify (in your code) where to save. And as Jeff said,
use always Specialfolder.applicationdata (or TPSF) and you will have no problems.

You know what they say when you assume. (The installer does not take care of anything you don’t tell it to.)

The easiest way to handle it cross-platform is to use a Copy Files step to put the things you need into the app’s resources, then on your app’s first launch (basically, if TPSF.AppSupport doesn’t exist) copy them out of your app resources into the TPSF.AppSupport folder after you create it.

There are actually, you can check out the Introduction to Programming Book - it gives a nice overview of programming and how to use Xojo all in one book. After that, there’s an entire manual you can read for Xojo included in your installation, check the Documentation folder and look for the PDF.

You’re welcome :slight_smile:
Big thanks to Axel for providing Linux support. I plan to include the localized folders soon as well.

Using Volume(index) is also mostly trouble-free.