Folders

Every folder corresponds to a directory in the file system. The desktop is a special type of work area and is represented by \OS!2 2.0 DESKTOP in the file system. The top-level folders on the desktop are subdirectories of \OS!2 2.0 DESKTOP. WPFolder objects and their contents are stored using a combination of a directory and the OS2.INI file. A folder may contain any kind of WPS object.

WPFileSystem objects are real files residing in a file system directory corresponding to the folder. These objects are stored in the folders directory but not in the folders section of the OS2.INI file.

WPAbstract objects are stored in the OS2.INI file. The information is stored with a pointer, called a HOBJECT. The folder stores the HOBJECTs for the abstract objects contained within it in the OS2.INI file, as can be seen in Figure "Relationship of Folder to Directory and OS2.INI File". This information is also stored in the EAs file for the directory associated with that folder. See The OS2.INI File for more details and some examples.

WPTransient objects can be placed in a folder but are not stored by the operating system and disappear from the folder when OS/2 is shut down.

Settings information is stored in the Extended Attributes of the folder's directory. Figure "Relationship of Folder to Directory and OS2.INI File" may help to illustrate these relationships:

In the folder, IH1 is the icon for a program, IH2 is the icon for a shadow copy of a file, and IF1 to IF4H1 are icons for data files. The data files are stored in a directory - in HPFS this bears the same name as the folder. Pointers (HOBJECTs) to the abstract objects are stored in the Extended Attributes (EA) for the directory.

The pointers are generated by the WPS when an abstract object is created (for example, by installing a program) and are unique to each WPAbstract object. The physical references to each WPAbstract object, together with its HOBJECT, are stored in the OS2.INI file. We can see that the program represented in the folder as IH1 is called AbstObj1 in the OS2.INI file and has a HOBJECT of H1. This HOBJECT is what is stored in the directory EA. You will notice that OS2.INI also separately records which WPAbstract objects are stored in each folder.

Folder Population

A folder populates itself with icons when it is opened and refreshed. The following approach is used:

  • The WPAbstract class keeps track of which folders its instances are in.
  • Pointers to WPAbstract objects (programs, shadows, etc.) are read from the OS2.INI file and their icons are displayed.
  • The WPFindObjects method of WPAbstract, WPTransient, WPFileSystem, and any other base class is used to retrieve the contents of a folder. For example, in WPFileSystem this method reads the EAs for each file in the directory, which tells it the object's class and provides its icon. A message is sent to the appropriate class which then instantiates it. If the file doesn't have any EAs then the default used is the base class, WPFileSystem.
  • The EAs are read for the directory. This gives the name (or OS2.INI program reference) and icon position for each object to be displayed in the folder.
  • The object icon and title are displayed in the folder.

    Any alteration to the contents of a folder, such as adding a file or removing a shadow copy, is saved by the object when the event occurs. However, attributes of the folder, such as icon positions or the size and position of an opened view of the folder, are not saved until the contents view of that folder is closed.

    A folders view will not be automatically updated when a file is created or destroyed by a process outside the WPS process (such as from a command line in an OS/2 window). Restarting the system may resolve this.

    This is because the WPS does not receive every message from the file system concerning files which lay outside its workplace directory structure (that is, not under "OS!2 2.0 Desktop"). Notification is received if a new file is created or if an existing file is deleted or renamed, but not if an existing file is changed outside of the workplace.


    [Back: Workplace Shell Objects]
    [Next: File System Objects]