os
nimony/lib/std/os.nim
proc expandFilename(filename: string): stringReturns the full (
absolute) path of an existing filefilename, resolving symlinks. RaisesOSErroriffilenamedoes not exist.proc getAppFilename(): stringproc getAppDir(): stringfunc quoteShellWindows(s: string): stringQuote
s, so it can be safely passed to Windows API.Based on Python's
subprocess.list2cmdline. See this link for more details.func quoteShellPosix(s: string): stringQuote
s, so it can be safely passed to POSIX shell.func quoteShell(s: string): stringQuote
s, so it can be safely passed to shell.When on Windows, it calls
quoteShellWindows func. Otherwise, callsquoteShellPosix func.func quoteShellCommand(args: openArray): stringConcatenates and quotes shell arguments
args.proc getLastModificationTime(file: string): int64Returns the file's last modification time as nanoseconds since the Unix epoch (1970-01-01 UTC). Raises
OSErrorif the file does not exist or cannot be stat'ed.proc exitStatusLikeShell(status: int32): int32Converts exit code from
c_systeminto a shell exit code.proc findExe(exe: string): stringSearches for
exein the directories listed in the PATH environment variable (and, on POSIX, in the current directory ifexecontains a path separator). Returns""if the exe cannot be found.proc execShellCmd(command: string): int64Executes a
shell command:idx:.Command has the form 'program args' where args are the command line arguments given to program. The proc returns the error code of the shell when it has finished (zero if there is no error). The proc does not return until the process has finished.
To execute a program without having a shell involved, use osproc.execProcess proc.
Examples:
Nim discard execShellCmd("ls -la")proc getFileSize(file: string): int64Returns the file size of
file(in bytes).