DisplaySplitFilename

Synopsis

Processes a full filename and path, splitting the filename and path into two strings, and displays them in a UI panel.



module DSFCore <src_file="dispfile.cxx"> {
   string+IPort2  FullFileName;

   cxxmethod update (
      .FullFileName+read+notify,
      .FileName+write,
      .Path+write,
      .ValidName+write
   );

   string+OPort2  FileName;
   string+OPort2  Path;
   boolean+OPort2 ValidName;
};

Description

The DSFCore module takes a full filename string as input. This input is processed by a C++ method and split into two strings; the directory path and the actual filename. A User macro is also provided that allows the strings to assembled into a user-interface panel. This macro is intended to provide more readable feedback to users about the file they have selected.

The module assumes that the directory path is the part of the full filename before the final file separator. Conversely the filename is the part of the full filename after the final file separator. The final file separator character is not included in either string. The module is designed to search for both forms of file separator(i.e. \ or /). On Windows systems a backslash(\) is initially searched for. If this is not found then a forward slash(/) is searched for. On other systems a forward slash is looked for before a backslash.

Inputs

FullFileName

Name of the file to be split into file and directory parts. This parameter is a string value.

Outputs

FileName

The actual filename extracted from the input FullFileName parameter.

Path

The directory path extracted from the input FullFileName parameter.

ValidName

A boolean flag indicating that the supplied input parameter is a valid filename string. If no file separator can be found this flag is cleared.

Utility Macros

The display_split_filename user macro makes use of the DSFCore low-level module and the DSF_UI user interface macro. The DSFCore module contains all the C++ code necessary for this project.

Example

The DisplaySplitFilename example application is provided. This demonstrates now the display_split_filename macro can be connected to a file dialog box so that it displays the path and filename separately.

Files

iac_proj/dispfile/dsf_mods.v contains the V definition of the DSFCore module.

iac_proj/dispfile/dsf_macs.v contains the V definitions of the DSF_UI UI macro, the display_split_filename user macro and the DisplaySplitFilenameEg example applications.

Other Notes

The low-level DisplaySplitFilenameMods library containing the DSFCore module does not specify a process. By default the express process will be used.

Author


Mark Ward, Advanced Visual Systems, Inc.

Modifications

Andrew Dodd, International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also

n/a