parent
5484352d26
commit
44aadd50cf
1 changed files with 77 additions and 95 deletions
|
|
@ -1,66 +1,95 @@
|
||||||
# Include file that implements 'DirSep' and friends. Do not import this when
|
# Include file that implements 'DirSep' and friends. Do not import this when
|
||||||
# you also import ``os.nim``!
|
# you also import ``os.nim``!
|
||||||
|
|
||||||
|
# Improved based on info in 'compiler/platform.nim'
|
||||||
|
|
||||||
const
|
const
|
||||||
doslikeFileSystem* = defined(windows) or defined(OS2) or defined(DOS)
|
doslikeFileSystem* = defined(windows) or defined(OS2) or defined(DOS)
|
||||||
|
|
||||||
when defined(Nimdoc): # only for proper documentation:
|
const
|
||||||
const
|
CurDir* =
|
||||||
CurDir* = '.'
|
when defined(macos): ':'
|
||||||
## The constant character used by the operating system to refer to the
|
elif defined(genode): '/'
|
||||||
## current directory.
|
else: '.'
|
||||||
##
|
## The constant character used by the operating system to refer to the
|
||||||
## For example: `'.'` for POSIX or `':'` for the classic Macintosh.
|
## current directory.
|
||||||
|
##
|
||||||
|
## For example: `'.'` for POSIX or `':'` for the classic Macintosh.
|
||||||
|
|
||||||
ParDir* = ".."
|
ParDir* =
|
||||||
## The constant string used by the operating system to refer to the
|
when defined(macos): "::"
|
||||||
## parent directory.
|
else: ".."
|
||||||
##
|
## The constant string used by the operating system to refer to the
|
||||||
## For example: `".."` for POSIX or `"::"` for the classic Macintosh.
|
## parent directory.
|
||||||
|
##
|
||||||
|
## For example: `".."` for POSIX or `"::"` for the classic Macintosh.
|
||||||
|
|
||||||
DirSep* = '/'
|
DirSep* =
|
||||||
## The character used by the operating system to separate pathname
|
when defined(macos): ':'
|
||||||
## components, for example: `'/'` for POSIX, `':'` for the classic
|
elif doslikeFileSystem or defined(vxworks): '\\'
|
||||||
## Macintosh, and `'\\'` on Windows.
|
elif defined(RISCOS): '.'
|
||||||
|
else: '/'
|
||||||
|
## The character used by the operating system to separate pathname
|
||||||
|
## components, for example: `'/'` for POSIX, `':'` for the classic
|
||||||
|
## Macintosh, and `'\\'` on Windows.
|
||||||
|
|
||||||
AltSep* = '/'
|
AltSep* =
|
||||||
## An alternative character used by the operating system to separate
|
when doslikeFileSystem: '/'
|
||||||
## pathname components, or the same as `DirSep <#DirSep>`_ if only one separator
|
elif defined(haiku): ':'
|
||||||
## character exists. This is set to `'/'` on Windows systems
|
else: DirSep
|
||||||
## where `DirSep <#DirSep>`_ is a backslash (`'\\'`).
|
## An alternative character used by the operating system to separate
|
||||||
|
## pathname components, or the same as `DirSep <#DirSep>`_ if only one separator
|
||||||
|
## character exists. This is set to `'/'` on Windows systems
|
||||||
|
## where `DirSep <#DirSep>`_ is a backslash (`'\\'`).
|
||||||
|
|
||||||
PathSep* = ':'
|
PathSep* =
|
||||||
## The character conventionally used by the operating system to separate
|
when defined(macos) or defined(RISCOS): ','
|
||||||
## search patch components (as in PATH), such as `':'` for POSIX
|
elif doslikeFileSystem or defined(vxworks): ';'
|
||||||
## or `';'` for Windows.
|
elif defined(PalmOS) or defined(MorphOS): ':' # platform has ':' but osseps has ';'
|
||||||
|
else: ':'
|
||||||
|
## The character conventionally used by the operating system to separate
|
||||||
|
## search patch components (as in PATH), such as `':'` for POSIX
|
||||||
|
## or `';'` for Windows.
|
||||||
|
|
||||||
FileSystemCaseSensitive* = true
|
FileSystemCaseSensitive* =
|
||||||
## True if the file system is case sensitive, false otherwise. Used by
|
when defined(macos) or defined(macosx) or doslikeFileSystem or defined(vxworks) or
|
||||||
## `cmpPaths proc <#cmpPaths,string,string>`_ to compare filenames properly.
|
defined(PalmOS) or defined(MorphOS): false
|
||||||
|
else: true
|
||||||
|
## True if the file system is case sensitive, false otherwise. Used by
|
||||||
|
## `cmpPaths proc <#cmpPaths,string,string>`_ to compare filenames properly.
|
||||||
|
|
||||||
ExeExt* = ""
|
ExeExt* =
|
||||||
## The file extension of native executables. For example:
|
when doslikeFileSystem: "exe"
|
||||||
## `""` for POSIX, `"exe"` on Windows (without a dot).
|
elif defined(atari): "tpp"
|
||||||
|
elif defined(netware): "nlm"
|
||||||
|
elif defined(vxworks): "vxe"
|
||||||
|
elif defined(nintendoswitch): "elf"
|
||||||
|
else: ""
|
||||||
|
## The file extension of native executables. For example:
|
||||||
|
## `""` for POSIX, `"exe"` on Windows (without a dot).
|
||||||
|
|
||||||
ScriptExt* = ""
|
ScriptExt* =
|
||||||
## The file extension of a script file. For example: `""` for POSIX,
|
when doslikeFileSystem: "bat"
|
||||||
## `"bat"` on Windows.
|
else: ""
|
||||||
|
## The file extension of a script file. For example: `""` for POSIX,
|
||||||
|
## `"bat"` on Windows.
|
||||||
|
|
||||||
DynlibFormat* = "lib$1.so"
|
DynlibFormat* =
|
||||||
## The format string to turn a filename into a `DLL`:idx: file (also
|
when defined(macos): "$1.dylib" # platform has $1Lib
|
||||||
## called `shared object`:idx: on some operating systems).
|
elif defined(macosx): "lib$1.dylib"
|
||||||
|
elif doslikeFileSystem or defined(atari): "$1.dll"
|
||||||
|
elif defined(MorphOS): "$1.prc"
|
||||||
|
elif defined(PalmOS): "$1.prc" # platform has lib$1.so
|
||||||
|
elif defined(genode): "$1.lib.so"
|
||||||
|
elif defined(netware): "$1.nlm"
|
||||||
|
elif defined(amiga): "$1.Library"
|
||||||
|
else: "lib$1.so"
|
||||||
|
## The format string to turn a filename into a `DLL`:idx: file (also
|
||||||
|
## called `shared object`:idx: on some operating systems).
|
||||||
|
|
||||||
elif defined(macos):
|
ExtSep* = '.'
|
||||||
const
|
## The character which separates the base filename from the extension;
|
||||||
CurDir* = ':'
|
## for example, the `'.'` in ``os.nim``.
|
||||||
ParDir* = "::"
|
|
||||||
DirSep* = ':'
|
|
||||||
AltSep* = Dirsep
|
|
||||||
PathSep* = ','
|
|
||||||
FileSystemCaseSensitive* = false
|
|
||||||
ExeExt* = ""
|
|
||||||
ScriptExt* = ""
|
|
||||||
DynlibFormat* = "$1.dylib"
|
|
||||||
|
|
||||||
# MacOS paths
|
# MacOS paths
|
||||||
# ===========
|
# ===========
|
||||||
|
|
@ -81,50 +110,3 @@ elif defined(macos):
|
||||||
# waterproof. In case of equal names the first volume found will do.
|
# waterproof. In case of equal names the first volume found will do.
|
||||||
# Two colons "::" are the relative path to the parent. Three is to the
|
# Two colons "::" are the relative path to the parent. Three is to the
|
||||||
# grandparent etc.
|
# grandparent etc.
|
||||||
elif doslikeFileSystem:
|
|
||||||
const
|
|
||||||
CurDir* = '.'
|
|
||||||
ParDir* = ".."
|
|
||||||
DirSep* = '\\' # separator within paths
|
|
||||||
AltSep* = '/'
|
|
||||||
PathSep* = ';' # separator between paths
|
|
||||||
FileSystemCaseSensitive* = false
|
|
||||||
ExeExt* = "exe"
|
|
||||||
ScriptExt* = "bat"
|
|
||||||
DynlibFormat* = "$1.dll"
|
|
||||||
elif defined(PalmOS) or defined(MorphOS):
|
|
||||||
const
|
|
||||||
DirSep* = '/'
|
|
||||||
AltSep* = Dirsep
|
|
||||||
PathSep* = ';'
|
|
||||||
ParDir* = ".."
|
|
||||||
FileSystemCaseSensitive* = false
|
|
||||||
ExeExt* = ""
|
|
||||||
ScriptExt* = ""
|
|
||||||
DynlibFormat* = "$1.prc"
|
|
||||||
elif defined(RISCOS):
|
|
||||||
const
|
|
||||||
DirSep* = '.'
|
|
||||||
AltSep* = '.'
|
|
||||||
ParDir* = ".." # is this correct?
|
|
||||||
PathSep* = ','
|
|
||||||
FileSystemCaseSensitive* = true
|
|
||||||
ExeExt* = ""
|
|
||||||
ScriptExt* = ""
|
|
||||||
DynlibFormat* = "lib$1.so"
|
|
||||||
else: # UNIX-like operating system
|
|
||||||
const
|
|
||||||
CurDir* = '.'
|
|
||||||
ParDir* = ".."
|
|
||||||
DirSep* = '/'
|
|
||||||
AltSep* = DirSep
|
|
||||||
PathSep* = ':'
|
|
||||||
FileSystemCaseSensitive* = when defined(macosx): false else: true
|
|
||||||
ExeExt* = ""
|
|
||||||
ScriptExt* = ""
|
|
||||||
DynlibFormat* = when defined(macosx): "lib$1.dylib" else: "lib$1.so"
|
|
||||||
|
|
||||||
const
|
|
||||||
ExtSep* = '.'
|
|
||||||
## The character which separates the base filename from the extension;
|
|
||||||
## for example, the `'.'` in ``os.nim``.
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue