Included files in standalone apps
I was thinking back to the days when I used AMOS and remembered a very useful feature it had. Using a set of commands you were able to load data into banks and then back out again at runtime.
I was wondering if there is a way to include files inside an MMF2 standalone application which could then be saved out at runtime; an example application of this might be a standard set of level files for a game or a default configuration / licence file, should those become deleted from the game directory. Obviously certain extensions do allow you to include data in the compiled standalone, but I cannot see a way to do what I'm asking about.
If there is no way to do this at present, would this be a particularly complex extension for someone to make? I've had some success with binary appending and NTFS file streams (ADS) to include additional data, but it is far from cross-platform and not always so reliable.
Any ideas?
Re: Included files in standalone apps
You can use 2 options for that in MMF2 :
Include external files
If this option is selected (in the properties of the application), MMF2 automatically includes in the EXE file all the files that are specified either in object properties, or in action/expression/condition filename parameters where you select the file in a file selector (not in a simple text expression).
When the application starts, MMF2 extracts all the files to a temporary directory and updates all the filenames in the application. If you want to access one of these files with a simple expression you can use AppTempPath$ + "name of your file".
Binary files (Data Elements editor)
If you don't want to include all the external files to your application, or if you want to access them directly from the EXE file, you can add files to the Binary Files tab of the Data Elements editor. These files are included in the EXE file and can be read directly from the EXE by objects that support them (all the Clickteam object + a few ones).
When an object that support this feature wants to read a file, it asks MMF2 to open it. MMF2 first checks if the pathname is the one of one of the embedded binary files and if so directly opens the EXE file at the position of the embedded file (otherwise it tries to open the file).
The next build of MMF2 (247) will contain an action that allows to extract an embedded binary file to a temporary file. I guess that's the best solution for you.
Re: Included files in standalone apps
Nothing to do with the subject x)
Hey, Stop =)
Re: Included files in standalone apps
Hi Yves,
thanks for that. Yes, the extract an embedded file feature is exactly what I'm after, that will be great :D
Cheers.
Re: Included files in standalone apps
Hi Alsonso! How's it going? It's been a long time...
Re: Included files in standalone apps
Yves,
I've had trouble in the past using stored files. One example is ini files. Another is the file that stores the screen capture graphic. I need to run my applications over the network at my school didstrict. They have locked down the computers so there may not be permissions for many users to most directories on their machine's hard drive. Is the AppTempPath$ a path that users typically or always have permission to write to? Any more infor on how this network / permission stuff works would be appreciated, since I'm still confused by it all and how to make my applications work using it.
Thansk in advance,
Steve
Re: Included files in standalone apps
Quote:
Is the AppTempPath$ a path that users typically or always have permission to write to?
Yes, files in the Windows temporary directory can be written by any user. However files in this directory are removed as soon as the application exits. If you need to store files for each user you can store them in a sub-directory of the user's application data directory (you can retrieve the pathname of this directory with an expression of the File object).
Re: Included files in standalone apps
Yves,
Thanks for the info.
Let's see if I understand this. On each user's machine, under his user name, each application has a data directory where it can store files? So I found the following path for MMF2:
C:\Documents and Settings\Stephen\Application Data\Clickteam\MMF2 Developer
Is this directory automatically created when an application is opened or do I have to create it? And what syntax would be needed to retrive this pathname from the File object?
Steve
Re: Included files in standalone apps
Quote:
On each user's machine, under his user name, each application has a data directory where it can store files?
Correct.
You have to create yourself your own subdirectory in the app data directory (the Clickteam\MMF2 Developer directory is created by MMF2).
No idea about the syntax, just take a look at the expressions of the File object.
Re: Included files in standalone apps
With that next build's feature, what if i had an extension that relies on an external dll, can you embed and extract that dll without the exe crashing?