file handling
when building an application which may be used under different
environments, one difficulty is coping with documents which may be
moved to different directories on other machines. saving a file which
has pointers to full pathnames is going to be inherently unportable. one
approach is to store filenames on their own, with no directory
information. the application searches through a number of locally
defined directories to find the file. to support this, the class
wxpathlist makes adding directories and searching for files easy, and
the global function wxfilenamefrompath allows the application to
strip off the filename from the path if the filename must be stored.
this has undesirable ramifications for people who have documents of the
same name in different directories.
as regards the limitations of dos 8+3 single-case filenames versus
unrestricted unix filenames, the best solution is to use dos filenames
for your application, and also for document filenames if the user
is likely to be switching platforms regularly. obviously this latter
choice is up to the application user to decide. some programs (such as
yacc and lex) generate filenames incompatible with dos; the best
solution here is to have your unix makefile rename the generated files
to something more compatible before transferring the source to dos.
transferring dos files to unix is no problem, of course, apart from eol
conversion for which there should be a utility available (such as
dos2unix).
see also the file functions section of the reference manual for
descriptions of miscellaneous file handling functions.
|