► |  | Reference: Racket

1 | Language Model
2 | Syntactic Forms
3 | Datatypes
4 | Structures
5 | Classes and Objects
6 | Units
7 | Contracts
8 | Pattern Matching
9 | Control Flow
10 | Concurrency
11 | Macros
12 | Input and Output
13 | Reflection and Security
14 | Operating System
15 | Memory Management
16 | Unsafe Operations
17 | Running Racket
| Bibliography
| Index

► | 14 | Operating System

14.1 | Paths
14.2 | Filesystem
14.3 | Networking
14.4 | Processes
14.5 | Logging
14.6 | Time
14.7 | Environment and Runtime Information
14.8 | Command-Line Parsing

▼ | 14.1 | Paths

14.1.1 | Manipulating Paths
14.1.2 | More Path Utilities
14.1.3 | Unix and Mac OS X Paths
14.1.4 | Windows Path Conventions

top ← prev up next →

##### 14.1.3`` Unix and Mac OS X Paths

In Unix and Mac OS X paths, a / separates elements of the path, . as a path element always means the directory indicated by preceding path, and .. as a path element always means the parent of the directory indicated by the preceding path. A leading ~ in a path is not treated specially, but expand-user-path can be used to convert a leading ~ element to a user-specific directory. No other character or byte has a special meaning within a path. Multiple adjacent / are equivalent to a single / (i.e., they act as a single path separator).

A path root is always /. A path starting with / is an absolute, complete path, and a path starting with any other character is a relative path.

Any pathname that ends with a / syntactically refers to a directory, as does any path whose last element is . or ...

A Unix and Mac OS X path is cleansed by replacing multiple adjacent /s with a single /.

For ( bytes->path-element bstr), bstr must not contain any /, otherwise the exn:fail:contract exception is raised. The result of ( path-element->bytes path) or ( path-element->string path) is always the same as the result of ( path->bytes path) and ( path->string path). Since that is not the case for other platforms, however, path-element->bytes and path-element->string should be used when converting individual path elements.

Under Mac OS X, Finder aliases are zero-length files.

top ← prev up next →