diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-10-18 02:29:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 20:29:00 +0200 |
commit | c0824b9b80f50807fc41b621760c4b685d1d7497 (patch) | |
tree | 76a9076a954198b00b2001eae452b384758d6d5f /lib/pure | |
parent | b7f1757952047258e9639c173145ca88f549c727 (diff) | |
download | Nim-c0824b9b80f50807fc41b621760c4b685d1d7497.tar.gz |
[`std/os` clean up] import and export `osseps` (#20580)
import and export osseps
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/includes/osseps.nim | 111 | ||||
-rw-r--r-- | lib/pure/os.nim | 3 | ||||
-rw-r--r-- | lib/pure/pathnorm.nim | 2 |
3 files changed, 3 insertions, 113 deletions
diff --git a/lib/pure/includes/osseps.nim b/lib/pure/includes/osseps.nim deleted file mode 100644 index 1ea587e3c..000000000 --- a/lib/pure/includes/osseps.nim +++ /dev/null @@ -1,111 +0,0 @@ -# Include file that implements 'DirSep' and friends. Do not import this when -# you also import `os.nim`! - -# Improved based on info in 'compiler/platform.nim' - -const - doslikeFileSystem* = defined(windows) or defined(OS2) or defined(DOS) - -const - CurDir* = - when defined(macos): ':' - elif defined(genode): '/' - else: '.' - ## The constant character used by the operating system to refer to the - ## current directory. - ## - ## For example: `'.'` for POSIX or `':'` for the classic Macintosh. - - ParDir* = - when defined(macos): "::" - else: ".." - ## The constant string used by the operating system to refer to the - ## parent directory. - ## - ## For example: `".."` for POSIX or `"::"` for the classic Macintosh. - - DirSep* = - when defined(macos): ':' - elif doslikeFileSystem or defined(vxworks): '\\' - 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* = - when doslikeFileSystem: '/' - else: DirSep - ## An alternative character used by the operating system to separate - ## pathname components, or the same as DirSep_ if only one separator - ## character exists. This is set to `'/'` on Windows systems - ## where DirSep_ is a backslash (`'\\'`). - - PathSep* = - when defined(macos) or defined(RISCOS): ',' - elif doslikeFileSystem or defined(vxworks): ';' - elif defined(PalmOS) or defined(MorphOS): ':' # platform has ':' but osseps has ';' - else: ':' - ## The character conventionally used by the operating system to separate - ## search path components (as in PATH), such as `':'` for POSIX - ## or `';'` for Windows. - - FileSystemCaseSensitive* = - when defined(macos) or defined(macosx) or doslikeFileSystem or defined(vxworks) or - defined(PalmOS) or defined(MorphOS): false - else: true - ## True if the file system is case sensitive, false otherwise. Used by - ## `cmpPaths proc`_ to compare filenames properly. - - ExeExt* = - when doslikeFileSystem: "exe" - 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* = - when doslikeFileSystem: "bat" - else: "" - ## The file extension of a script file. For example: `""` for POSIX, - ## `"bat"` on Windows. - - DynlibFormat* = - when defined(macos): "$1.dylib" # platform has $1Lib - 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). - - ExtSep* = '.' - ## The character which separates the base filename from the extension; - ## for example, the `'.'` in `os.nim`. - - # MacOS paths - # =========== - # MacOS directory separator is a colon ":" which is the only character not - # allowed in filenames. - # - # A path containing no colon or which begins with a colon is a partial - # path. - # E.g. ":kalle:petter" ":kalle" "kalle" - # - # All other paths are full (absolute) paths. E.g. "HD:kalle:" "HD:" - # When generating paths, one is safe if one ensures that all partial paths - # begin with a colon, and all full paths end with a colon. - # In full paths the first name (e g HD above) is the name of a mounted - # volume. - # These names are not unique, because, for instance, two diskettes with the - # same names could be inserted. This means that paths on MacOS are not - # 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 - # grandparent etc. diff --git a/lib/pure/os.nim b/lib/pure/os.nim index a635c62ef..3e7c7cfc9 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -95,7 +95,8 @@ type OSErrorCode* = distinct int32 ## Specifies an OS Error Code. -include "includes/osseps" +import std/private/osseps +export osseps proc absolutePathInternal(path: string): string {.gcsafe.} diff --git a/lib/pure/pathnorm.nim b/lib/pure/pathnorm.nim index a71ae0762..4cdc02303 100644 --- a/lib/pure/pathnorm.nim +++ b/lib/pure/pathnorm.nim @@ -14,7 +14,7 @@ # Yes, this uses import here, not include so that # we don't end up exporting these symbols from pathnorm and os: -import includes/osseps +import std/private/osseps type PathIter* = object |