---
name: "Ns_HomePath"
section: "3aolserver"
platform: "linux"
package: "aolserver4-dev"
version: "4.5.1-18.1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Ns_HomePath/3aolserver"
---

# Ns\_HomePath(3aolserver)

Pathname procedures

```

```

## NAME

Ns\_HomePath, Ns\_LibPath, Ns\_MakePath, Ns\_ModulePath, Ns\_NormalizePath, Ns\_PathIsAbsolute - Pathname procedures

## SYNOPSIS

```
#include "ns.h"

char *
Ns_HomePath(Ns_DString *dest, ...)

char *
Ns_LibPath(Ns_DString *dest, ...)

char *
Ns_MakePath(Ns_DString *dest, ...)

char *
Ns_ModulePath(Ns_DString *dest, char *server, char *module, ...)

char *
Ns_NormalizePath(Ns_DString *dsPtr, char *path)

int
Ns_PathIsAbsolute(char *path)
```

## DESCRIPTION

These functions operate on file pathnames. They work with Unix and Windows pathnames on their respective hosts.

- **Ns\_HomePath**(*dest, ...*)

  Construct a path name relative to the home directory of the server. The full path is constructed by appending the library directory followed by each of the variable number of string elements after the *dest* argument.  The elements will be separated by a */* character.  The list must be terminated with a NULL string.

- **Ns\_LibPath**(*dest, ...*)

  Construct a path name relative to the library directory of the server, normally the *lib/* subdirectory of the home directory. The full path is constructed by appending the library directory followed by each of the variable number of string elements after the *dest* argument.  The elements will be separated by a */* character.  The list must be terminated with a NULL string.

- **Ns\_MakePath**(*dest, ...*)

  Construct a path name from a list of path elements. The Ns\_MakePath function constructs a path name by appending a list of path elements to the given Ns\_DString. The path elements are separated by single slashes, and the resulting path name is appended to the given Ns\_DString. The last argument needs to be NULL to indicate the end of the argument list.

- **Ns\_ModulePath**(*dest, char \*server, char \*module, ...*)

  Construct a server and/or module specific pathname relative to the server home directory.  The path in constructed by first appending the server home directory.  Next, if the *server* argument is not NULL, "server/*server* *and if the module* argument is not NULL, "module/*module*" will be appended.  Finally, all other string elements, if any, will be appended to the destination with separating */* characters. The list must be terminated with a NULL string.

- **Ns\_NormalizePath**(*dsPtr, path*)

  Normalize a path name. This function removes any extraneous slashes from the path and resolves "." and ".."  references. The result is appended to the given Ns\_DString. The following code appends "/dog" to the Ns\_DString:

  ```
  Ns_NormalizePath(&ds,
      "/dog/cat/../../rat/../../dog//mouse/..");
  ```

- **Ns\_PathIsAbsolute**(*path*)

  Check for an absolute path name. Return NS\_TRUE if the path is absolute and NS\_FALSE otherwise. Under Unix, an absolute path starts with a "/". On Windows, it starts with a drive letter followed immediately by a ":".

## SEE ALSO

nsd(1), [info(n)](/info/n.md)

## KEYWORDS
