refactor os imports into corresponding small modules (#20720)
This commit is contained in:
parent
d735c447d3
commit
6166b796ba
8 changed files with 11 additions and 8 deletions
|
|
@ -24,8 +24,9 @@ when declared(math.signbit):
|
||||||
|
|
||||||
|
|
||||||
from std/envvars import getEnv, existsEnv, delEnv, putEnv, envPairs
|
from std/envvars import getEnv, existsEnv, delEnv, putEnv, envPairs
|
||||||
from std/os import walkDir, getAppFilename
|
from std/os import getAppFilename
|
||||||
from std/private/oscommon import dirExists, fileExists
|
from std/private/oscommon import dirExists, fileExists
|
||||||
|
from std/private/osdirs import walkDir
|
||||||
|
|
||||||
from std/times import cpuTime
|
from std/times import cpuTime
|
||||||
from std/hashes import hash
|
from std/hashes import hash
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ from std/strutils import contains, toLowerAscii
|
||||||
|
|
||||||
when not defined(nimscript):
|
when not defined(nimscript):
|
||||||
from std/osproc import execProcess
|
from std/osproc import execProcess
|
||||||
from std/os import existsEnv
|
from std/envvars import existsEnv
|
||||||
|
|
||||||
type
|
type
|
||||||
Distribution* {.pure.} = enum ## the list of known distributions
|
Distribution* {.pure.} = enum ## the list of known distributions
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ elif defined(posix):
|
||||||
else:
|
else:
|
||||||
{.error: "the memfiles module is not supported on your operating system!".}
|
{.error: "the memfiles module is not supported on your operating system!".}
|
||||||
|
|
||||||
import os, streams
|
import streams
|
||||||
|
import std/oserrors
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/[syncio, assertions]
|
import std/[syncio, assertions]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
##
|
##
|
||||||
## Unstable API.
|
## Unstable API.
|
||||||
|
|
||||||
from os import raiseOSError, osLastError
|
from std/oserrors import raiseOSError, osLastError
|
||||||
|
|
||||||
template distance*(lhs, rhs: pointer): int =
|
template distance*(lhs, rhs: pointer): int =
|
||||||
cast[int](rhs) - cast[int](lhs)
|
cast[int](rhs) - cast[int](lhs)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@
|
||||||
##
|
##
|
||||||
## TODO: `/dev/poll`, `event ports` and filesystem events.
|
## TODO: `/dev/poll`, `event ports` and filesystem events.
|
||||||
|
|
||||||
import os, nativesockets
|
import nativesockets
|
||||||
|
import std/oserrors
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/assertions
|
import std/assertions
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ when defined(js) or defined(nimscript) or defined(Standalone):
|
||||||
{.pragma: rtlFunc.}
|
{.pragma: rtlFunc.}
|
||||||
else:
|
else:
|
||||||
{.pragma: rtlFunc, rtl.}
|
{.pragma: rtlFunc, rtl.}
|
||||||
import os
|
import std/envvars
|
||||||
|
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ runnableExamples:
|
||||||
|
|
||||||
|
|
||||||
when not defined(js):
|
when not defined(js):
|
||||||
import os
|
import std/oserrors
|
||||||
|
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
import posix
|
import posix
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## This module is experimental and its interface may change.
|
## This module is experimental and its interface may change.
|
||||||
|
|
||||||
import winlean, os
|
import std/oserrors
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/widestrs
|
import std/widestrs
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue