mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
refactor os imports into corresponding small modules (#20720)
This commit is contained in:
@@ -24,8 +24,9 @@ when declared(math.signbit):
|
||||
|
||||
|
||||
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/osdirs import walkDir
|
||||
|
||||
from std/times import cpuTime
|
||||
from std/hashes import hash
|
||||
|
||||
@@ -31,7 +31,7 @@ from std/strutils import contains, toLowerAscii
|
||||
|
||||
when not defined(nimscript):
|
||||
from std/osproc import execProcess
|
||||
from std/os import existsEnv
|
||||
from std/envvars import existsEnv
|
||||
|
||||
type
|
||||
Distribution* {.pure.} = enum ## the list of known distributions
|
||||
|
||||
@@ -24,7 +24,8 @@ elif defined(posix):
|
||||
else:
|
||||
{.error: "the memfiles module is not supported on your operating system!".}
|
||||
|
||||
import os, streams
|
||||
import streams
|
||||
import std/oserrors
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/[syncio, assertions]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
##
|
||||
## Unstable API.
|
||||
|
||||
from os import raiseOSError, osLastError
|
||||
from std/oserrors import raiseOSError, osLastError
|
||||
|
||||
template distance*(lhs, rhs: pointer): int =
|
||||
cast[int](rhs) - cast[int](lhs)
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
##
|
||||
## TODO: `/dev/poll`, `event ports` and filesystem events.
|
||||
|
||||
import os, nativesockets
|
||||
import nativesockets
|
||||
import std/oserrors
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
@@ -61,7 +61,7 @@ when defined(js) or defined(nimscript) or defined(Standalone):
|
||||
{.pragma: rtlFunc.}
|
||||
else:
|
||||
{.pragma: rtlFunc, rtl.}
|
||||
import os
|
||||
import std/envvars
|
||||
|
||||
include "system/inclrtl"
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ runnableExamples:
|
||||
|
||||
|
||||
when not defined(js):
|
||||
import os
|
||||
import std/oserrors
|
||||
|
||||
when defined(posix):
|
||||
import posix
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## This module is experimental and its interface may change.
|
||||
|
||||
import winlean, os
|
||||
import std/oserrors
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/widestrs
|
||||
|
||||
Reference in New Issue
Block a user