OS.Constants contains Operating System-specific constants. This module is largely a companion to js-ctypes.
From the main thread
OS.Constants for use in the main thread, add the following snippet to your code:
Components.classes["@mozilla.org/net/osfileconstantsservice;1"]. getService(Components.interfaces.nsIOSFileConstantsService). init();
From a chrome worker
No initialization is required. Module
OS.Constants is always available for chrome workers.
Constants related to system configuration.
||The name of the operating system (e.g. "Darwin").|
|DEBUG||Set to true on debug build configurations, non-existent otherwise.|
Paths of well-known files and directories.
||The path to the current profile.|
||The path to the user's home directory.|
||The path to the user's desktop directory (or, if it doesn't exist, the path to the user's home directory).|
||The path to the user's roaming application data directory.|
||The path to the user's local application data directory.|
||The path to the programs subdirectory in the user's start menu.|
||The path to the user's Library directory.|
||The path to the local Applications directory.|
Constants for interacting with libc. Useful mostly for using js-ctypes to interact with the following platforms:
- MacOS X;
- other variants of Unix.
OS.Constants.libc is available on all platforms, although some constants are not defined everywhere. Before using a constant, you should check that it is defined.
|EAGAIN||Resource temporarily unavailable|
|EBADF||Bad file descriptor|
|EFBIG||File too large|
|EISDIR||Is a directory|
(Not always available under Windows) Too many levels of symbolic links.
|EMFILE||Too many open files in the process|
|ENAMETOOLONG||Name too long|
|ENFILE||Too many open files on the system|
|ENOENT||No such file or directory|
|ENOMEM||Cannot allocate memory|
|ENOSPC||No space on device|
|ENOTDIR||Is not a directory|
|ENXIO||Device no configured or does not support operation|
|EOPNOTSUPP||(Not always available under Windows) Operation not supported.|
|EOVERFLOW||(Not always available under Windows) Value too large to be stored in datatype.|
|EPERM||Operation not permitted|
|ERANGE||Result too large|
|ETIMEDOUT||(Not always available under Windows) Operation timed out.|
|EWOULDBLOCK||(Not always available under Windows) Operation would block.|