Skip to main content
Log in

Mojo module

os

Implements os methods.

You can import a method from the os package. For example:

from os import listdir
from os import listdir

Aliases

  • SEEK_CUR = 1: Seek from the current position.
  • SEEK_END = 2: Seek from the end of the file.
  • SEEK_SET = 0: Seek from the beginning of the file.
  • sep = "\\" if eq(:string target_get_field(current_target(), "os"), "windows") else "/":

Functions

  • abort: Calls a target dependent trap instruction if available.
  • getuid: Retrieve the user ID of the calling process.
  • listdir: Gets the list of entries contained in the path provided.
  • makedirs: Creates a specified leaf directory along with any necessary intermediate directories that don't already exist.
  • mkdir: Creates a directory at the specified path. If the directory can not be created an error is raised. Absolute and relative paths are allowed, relative paths are resolved from cwd.
  • remove: Removes the specified file. If the path is a directory or it can not be deleted, an error is raised. Absolute and relative paths are allowed, relative paths are resolved from cwd.
  • removedirs: Remove a leaf directory and all empty intermediate ones. Directories corresponding to rightmost path segments will be pruned away until either the whole path is consumed or an error occurs. Errors during this latter phase are ignored, which occur when a directory was not empty.
  • rmdir: Removes the specified directory. If the path is not a directory or it can not be deleted, an error is raised. Absolute and relative paths are allowed, relative paths are resolved from cwd.
  • unlink: Removes the specified file. If the path is a directory or it can not be deleted, an error is raised. Absolute and relative paths are allowed, relative paths are resolved from cwd.

Was this page helpful?