Proposal for Binary Data

Introduction

MMF2 has a neat new feature that allows users and extensions to embed data files within MMF applications. This feature is known as Binary Data. It may not be obvious at first, but this new feature lends itself to a neat little capability. It allows extensions to retrieve data embedded within the MMF application. Unfortunately, right now, it is not very user-friendly. All embedded data files are referenced by their original paths (when they were embedded), which can be a problem if the path of the file changes. This would require the user to modify his code. The other drawback is that embedded files cannot be referenced directly. MMF only allows extensions to copy the files to disk to use them, which is somewhat unfortunate. But I suppose no one should be embedding large files anyway, so the overhead should be minimal. As you can see, it's a good feature, but with a few tweaks, it could be a great feature.

How to Take Advantage of Binary Data

There are three ways that extensions can take advantage of this new feature:

  1. Treat all file paths as if they were references to embedded files (current method): The extension uses MMF's mvGetFile method which does the following:
  2. Have the user use a special prefix to indicate that they want to reference an embedded data file: When passing data to an extension, the user could use a special prefix (like a ?) to tell the extension that what follows is a reference to an embedded data file. It could recognize the prefix and act accordingly.
  3. Have an MMF expression that extracts an embedded data file and returns the new path (personal favorite method): This path could then be passed to any extension as a regular file path, requiring no specail action by the user.

Requested Changes

No changes to MMF are actually required for extensions to make use of this new feature, but some changes could be made to help improve the feature.

  1. Allow the user to assign an optional alias to each embedded data file. This does two things. First, it makes it easier for the user to reference the embedded data file. Second, if the path of the file changes, the user will not need to modify his code.
  2. Create a new MMF expression: ExtractBinaryDatFile$(szFile, nDeleteFast)