Contents Previous Next

Directories/Locations

We sometimes refer to directories as locations.

Since this application relies heavily on XML, and the location of the data, we define two locations in terms of environment variables. We then use those environment variables to locate the files.

This table describes the two environment variables we use:
Variable Name>Description
NCLIP_DATA_DIRThe location of this user's data directory.
NCLIP_APP_DIRThe location of the executable.

Both of the above variables are fully qualified names. For example:

Note that we do NOT use a trailing directory separator.

NCLIP_APP_DIR must set as a global environment variable at the time of installation. If not, you may be constantly asked "Where are the help files?".

NCLIP_DATA_DIR is set as a user's environment variable which can vary between users. If it is not set, we pick a reasonable value.

These are one time setups, and must be remembered between sessions.

How to permanently set the Locations

Since the environment variables should be remembered from session to session, you will need to set them in the following ways.

Linux/Unix

First determine the type of shell you are using:

env | grep SHELL

You then should see something like:

SHELL=/bin/bash

In general you will need to edit your shell's startup file. Check the man page of your shell to find that. For bash it is .profile in you home directory. For tcsh it is .tcshrc, and for csh it is .cshrc.

Usually your program or application is on your desktop. However, this is not a requirement. NCLIP_APP_DIR can point anywhere. It should in all cases point to the location of the NCLIP executable.

Bash Users

Edit your .profile file adding these lines:
export NCLIP_DATA_DIR=~/data
export NCLIP_APP_DIR=~/Desktop/NCLIP
Logout, and then log back in. Type env to verify that the NCLIP variables are now set.

Your data will will now be in your home sub-directory data and your program will be accessed through the home sub-directory Desktop/NCLIP.

Csh or tcshrc Users

Edit your .cshrc or .tcshrc file adding these lines:
setenv NCLIP_DATA_DIR ~/data
setenv NCLIP_APP_DIR ~/Desktop/NCLIP
Logout, and then log back in. Type env to verify that the NCLIP variables are now set.

Your data will then be in your home sub-directory data and your program should be in the home sub-directory Desktop/NCLIP.


Macintosh OSX

You can set environment variables quite easily from a Terminal session, or set them up in your shell's start up files. This works fine for UNIX-ey programs. It also works if you launch NCLIP from the command line. However, for Mac GUI programs, which don't see variables set in these ways you will need to make an XML file in a pre-determined location. To set up variables that are truly global, and can be accessed from command line and GUI alike, you want to set up an environment.plist file.

Inside the ~/.MacOSX directory (create it if it doesn't already exist), create a file called environment.plist. This is a plain old Mac OS X Property List. Create an environment.plist file that looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>NCLIP_DATA_DIR</key>
        <string>/Users/YourAccount/YourDataDirectory</string>
        <key>NCLIP_APP_DIR</key>
        <string>/Users/YourAccount/Desktop/NClipMac</string>
</dict>
</plist><HR>

For each environment variable you want to set, just add another and pair. The Property List Editor (found at /Developer/Applications/Utilities/Property List Editor.app; requires Developer Tools) can help with the creation and maintenance of this file.

When you log into your system the next time, the environment variables defined in this way will be available to all programs.

Here's an Apple Tech Note on this subject: http://developer.apple.com/qa/qa2001/qa1067.html

Your data will then be in your home sub-directory YourDataDirectory and your program should be in the home sub-directory Desktop/NClipMac.

The changes will not take effect until you logoff your machine, and then log back in.

After you have logged back in, test the changes by examining


env | grep NCLIP
and seeing if NCLIP_DATA_DIR and NCLIP_APP_DIR are set.

PC

Select Start->Control Panel->System.

Choose the Advanced tab. You then should see:

System Properties Window

Choose the Environment Variables button. You will then see

Environment Variables Window

You can add the variables to either the user (top window) or to the system (bottom window). Normally the data path is a user variable, and the application path is a system variable. Let's add the data path. Click on the top New button: Fill in your variable name and value:

Similarly, click on the bottom New button, and add your application location variable:

When you are done, you should see something like:


How Files are Found

The following table describes the locations used by NCLIP. All directory changes are made relative to either NCLIP_DATA_DIR or NCLIP_APP_DIR. In this way, XML files can be moved across platforms.

Warning: A common error is for the user to not have a HOME or a NCLIP_DATA environment variable defined.

In that case, the system will use the application directory for a data directory.

In this case, any sample default session in the application directory will be loaded without comment.

So make sure your NCLIP_DATA environment variable is set!

You must have write permission to this directory.

After your first save, the system will remember the new data set location. (Remember to use the Save As Default Session menu to save those locations for your next session.)
LocationDefaultStored in Default Xml file?Comments
XML$NCLIP_DATA_DIR environment variable, and lacking that, your HOME environment variable, and lacking that the location of the executableNoSince we want to move XML files between machines, this value is not stored in that file: It can change when moved to another machine. This is also by default the starting point for the location of data files.
DataSame as XML aboveYesWhen you open a data set, and then if you save your session using the Save as Default menu, the system will remember the new data location when you restart.

This may cause problems on a new system (you may not have the default data directory listed in the xml file), but only the first time you open a new data set.

Application$NCLIP_APP_DIRNoThis is an immutable value.
Help PathThe location of this applications help, usually $NCLIP_APP_DIR/help.Yes This is the help file location for NCLIP.

In some cases, we cannot find the separate help file. In those cases, we ask you to locate it by hand, and then save it automatically in the default session file.

Old Help PathUsually $NCLIP_APP_DIR/oldHelpYes This is the help file for the old application Clip.

In some cases, we cannot find the separate help file. In those cases, we ask you to locate it by hand, and then save it automatically in the default session file.

Data Maps$NCLIP_DATA_DIR/DataMap No, but this subdirectory is created at this location if does not exist. This location contains the XML files that contain the data maps used to parse your data sets.

If we do not find it, we will ask you to locate it.

When you share data formats with others, you will place their data maps in this subdirectory.

Using these directory maps, users can trade XML files, data files, and data maps across machines.

You can view your locations at any time using the Help->Show Locations menu. A typical set of locations is: