NextPrevUpTopContentsIndex

get-folder-path

Function
Summary

Gets the path of a special folder on a Microsoft Windows or Mac OS X machine.

Package

system

Signature

get-folder-path what &key create => result

Arguments

what

A keyword.

create

A boolean.

Values

result

A directory pathname naming the path, or nil .

Description

The function get-folder-path obtains the current value for various special folders often used by applications. It is useful because these paths may differ between versions of the operating system. get-folder-path is implemented only on Microsoft Windows and Mac OS X.

what indicates the purpose of the special folder. For instance, :common-appdata means the folder containing application data for all users.

The following values are recognized on Microsoft Windows and Mac OS X:

:appdata , :documents , :my-documents , :common-appdata , :common-documents and :local-appdata .

:documents is an alias for :my-documents .

The following values are recognized on Mac OS X only:

:my-library , :my-appsupport , :my-preferences , :my-caches , :my-logs , :common-library , :common-appsupport , :common-preferences , :common-caches , :common-logs , :system-library .

On Mac OS X, :appdata is an alias for :my-appsupport , :common-appdata is an alias for :common-appsupport , and :local-appdata is an alias for :common-appsupport .

If the folder does not exist and create is true, the folder is created. The default value of create is nil .

If the folder does exist, result is nil .

Compatibility note

In LispWorks 5.0 and previous versions, get-folder-path returns a string.

Example

This form constructs a pathname to a file foo.lisp in the user's documents directory:

(make-pathname 
 :name "foo" 
 :type "lisp" 
 :defaults
 (sys:get-folder-path :my-documents))
See also

get-user-profile-directory


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex