Use of Resources folder

Dave, I’m not afraid of some work. This program was first released in October, 2004, and it has grown through many updates. Now with more than 40 windows, it has grown to the point where it is becoming more and more difficult to make changes without creating new bugs. If you’re interested, find out about it at www.optimumplay.com.

Now changes in OS security over which I have no control have made it even harder to update and support.

All I’m asking for is some example code to copy from the CD (or a copy of it on the desktop). I just want it to copy the app to the Applications folder, and copy the data folder OpVPdata and its contents to SpecialFolder.ApplicationData.

From what you say, that’s very simple. Well, it probably is for someone who is already familiar with all of this, but I would really appreciate some help.

Even after someone is nice enough to offer that code, I’ll have a lot to do because the data files are accessed from so many places in the program.

[quote=433344:@Alberto De Poo]The forum messed up the last ) when it automatically created the URL.
I edited the link to fix it. Please try again.[/quote]

I still get a blank page.

Did you click the link on my post (fixed) or on the quoted text on your post (not fixed)?
Did you reload the page?

Here it is again:
User Guide: Inno Setup

It it still send you to an empty page, just copy this and paste it to your browser:

https://documentation.xojo.com/topics/windows/creating_an_installer_with_the_inno_setup_script_(64-bit_apps).html

Or check this blog post from Paul.

[quote=433349:@Alberto De Poo]Did you click the link on my post (fixed) or on the quoted text on your post (not fixed)?
Did you reload the page?

Here it is again:
User Guide: Inno Setup

It it still send you to an empty page, just copy this and paste it to your browser:

https://documentation.xojo.com/topics/windows/creating_an_installer_with_the_inno_setup_script_(64-bit_apps).html

Or check this blog post from Paul.[/quote]

Thanks, that works, but it’s just for Windows.

Yes, for Mac the most common thing is a DMG. Search Google for " create dmg installer"

Now that your app is in the applications folder, your code need to copy the files you want to the SpecialFolder.

You have syntax, explanation and example for copy file(s) and folder(s) there:

http://documentation.xojo.com/api/files/folderitem.html.CopyFileTo

You place the data to copy in Special.ApplicationData (or anywhere you want to put them, excepted the Application folder)

And for images, sounds, etc., follow a previous advice: drop the items in the navigation pane.
You can copy these data into folders to not get too many entries in the Navigation pane from a master folder located in your application archive. Put that code (plus some other checks) in the App.Open Event (as adviced previously)

You will access to these data using theu-ir name(s). For example, if you have a file called macOS_Logo, use:

Canvas_OS.Backdrop = macOS_Logo // of course, using your objects names.

No need (AFAIK) to go to Toledo for a Californian hollyday Resource folder).

Now, you may need a day or two for a good rest and resume the job on Tuesday.

Edit:

You may at first create a brand new project and place there code to copy the data that have to be copied to learn how to do it. Once this will be working fine, you only have to move the code into the main project (faster / less bug prone).

That’s what I intend to do, but please explain how the code would be less bug prone if incorporated into my main app? It’s been my experience in 66 years of programming various computers that the more code there is in one place, the more likely it will have bugs.

A simple project that does only one task is much easier to debug and support.

66 years of programming? that would imply you began in 1953… which being conservative would make you over 84 years old…
and even assuming you are only 66 (and therefore working with computers for 40something years), I would have thought that much experience would have taught you have to use documentation, how to learn from examples, and how (as Emile suggested) test new techniques in a stand alone program until a complete understanding was obtained.

For the record… I myself am currently 63 years old, and began working win computers in 1973… giving me 46 years of computer experience, and I have learned and/or taught myself more computer languages than I can count (including some I doubt 90% of the people on this forum have even heard of)… including designing and writing various interpreters, and the one thing you are correct about is that modular code is easier to debug, but then with 66 years experience you know that concept is relatively recent (80’s?)

Wow. That was some big iron!

https://www.computerhistory.org/timeline/1953/

[quote=433357:@Dave S]

66 years of programming? that would imply you began in 1953… which being conservative would make you over 84 years old…[/quote]

Oops, typo, but small error. I started programming on a Bendix G-15 in 1957 at Michigan Tech, so it’s only 62 years. I’m 82. Maybe you could give some allowance for my age and provide example code to open the OpVPdata folder in SpecialFolder.AppliicationData, or create that folder if it’s not already there, and copy the OpVPdata folder and all its contents from the desktop.

[quote=433359:@Tanner Lee]Wow. That was some big iron!

https://www.computerhistory.org/timeline/1953/[/quote]

The year was actually 1957. The Bendix G-15 was about the size of a refrigerator, had 400 vacuum tubes, the memory on a drum was 20 lines of 108 29-bit words for a total of a little less than 8k bytes. It could execute up to 300 machine code instructions per second with real tight coding, which was in sexidecimal. A FP decimal interpreter would execute about 7 instructions per second.

https://idioms.thefreedictionary.com/you+can't+teach+an+old+dog+new+tricks

As Dave said, it’s in the doc pops! Something like:

my_AppData_FI = SpecialFolder.AppliicationData.Child(OpVPdata)

Of course, you have to declare my_AppData_FI as FolderItem (_FI),
and OpVPdata have to be the application name as a string.

Then, you will use my_AppData_FI to access to your application data inside that folder.

I forget to mention the test against Nil (and create the my_AppData_FI folder before accessing it).

Have a nice Sunday all (it’s Easter here).

I write:
dim f as FolderItem
f = GetFolderItem( “SpecialFolder.ApplicationData” ).child( “OpVPdata” )
f.CreateAsFolder

which is as shown in the Xojo Language Reference, and I get nil object exception on that last line. I’ve tried several variations and searched the ref for any other examples to no avail. I’m at a dead end.

Almost every project has to put some initial data in the SpecialFolder, so there must be hundreds of examples of such code. Won’t someone please share the code to copy my initial data folder OpVPdata to SpecialFolder.ApplicationData?

dim f as FolderItem
f = SpecialFolder.ApplicationData.child( “OpVPdata” )
f.CreateAsFolder

[quote=433401:@Norman Palardy]dim f as FolderItem
f = SpecialFolder.ApplicationData.child( “OpVPdata” )
f.CreateAsFolder[/quote]

Oh, my stupid error. Thanks.

Now how do I copy my data folder OpVPdata from the desktop to that new folder in ApplicationData?

see http://documentation.xojo.com/api/files/folderitem.html.CopyFileTo

Thank you so much, Norman. I searched the refs but could find anything like this. Wonder why no one would point me to this before?

Looks like Dave specifically mentioned that yesterday…

[quote]FolderItem.CopyFileTo
Method
FolderItem.CopyFileTo(Destination as FolderItem)[/quote]

But now it is more clearly than before. :wink:

And the “stupid error” mentioned above, that’s me as well.
One of the code variations works well, but sometimes it is (or seems to be) a magic to find the correct one.

Now to deal with
f=GetFolderItem(PathToStuffFldr(app.FilepathStr),FolderItem.PathTypeNative)