Assignment file redirections

Tony Marston - 2nd November 2001

This tip was originally published in the Developer's Club on the Uniface web site by Leo van den Berge, but it is so useful I just have to repeat it here.

Problem Statement:

File name entry and ASN file redirections

When a function within IDF requires the name of a file it allows the user to either enter a name manually, or displays a standard filebox which allows the user to browse through the directory structure. However, a filename which is chosen via a filebox is always returned fully qualified (eg: C:\projects\data\fname.txt) whereas a name entered manually may not be. If the ASN file contains an entry that matches that filename (eg: *.TXT = TEXT/*.TXT) then this redirection is applied to the fully qualified filename, turning it from a valid name into an invalid one. This can cause hours of confusion as the function within IDF is given a perfectly valid file name, but it refuses to work because it is being redirected to a non-existent folder.

Desired solution:

To avoid this confusion any redirection specified in the ASN file should NOT be applied to any fully qualified filename.

Suggested workaround:

Assignments for FilenameSpecification is based on a 3 parts recognition.

  1. A Prepart:

    general disk + directory specification separated by a colon ':' a slash '/' or a backslash '\'

  2. A Filename
  3. A Postpart:

    type or extension separated by a dot (.)

All these parts can be specified separately to allow more flexible assignments. Therefore the problem mentioned here that specs loaded via a filebox are remapped due to assignment can simple avoided by be more specific in the assignment.

example:

*.bmp c:\bitmap\*.bmp

this will indeed map all files with the extension "bmp" to directory c:\bitmap but with the following assignments

*\*.bmp  *\*.bmp
*.bmp  c:\bitmap\*.bmp

means that when a (bmp) file has a directory specification it will be mapped to its own, and only when there is no directory specification it will mapped to directory c:\bitmap.

This was just an example for bitmaps but a more common assignment will be:

[FILES]
*\*.*  *\*.*             ; keep all files with disk/directory spec
*.txt  c:\text\*.txt     ; map following by specific (defaults)
*.bmp  c:\bitmap\*.bmp   ; map etc etc etc

Tony Marston
2nd November 2001

mailto:tony@tonymarston.net
mailto:TonyMarston@hotmail.com
http://www.tonymarston.net

counter