Skip to content

CrossLib namespace

Paul Bunyan edited this page Jun 19, 2014 · 2 revisions
#include "crosslib.h"

Since version 0.2 "Firmament", iash provides a small library that covers a few platform-independent actions. Functions will be added as development continues. If you want to add a function, either make a pull request or add an enhancement in the issue tracker.

Currently, CrossLib supports Unix-based systems (e.g. Linux, OSX) and Windows. If you want to add a system, make a pull request.

If you are compiling on Unix-based systems, you need to link the tinfo library. This might change between systems (it could be terminfo, curses, or ncurses). If you use CMake, then this is already done for you.

Version: v0.2 "Firmament"

Terminal functions

CrossLib::clearScreen()

Introduced in v0.2 "Firmament"

void CrossLib::clearScreen ()

Clears the terminal screen.

Filesystem manipulation

CrossLib::mkdir()

Introduced in v0.2 "Firmament"

int mkdir (const char* pathname)

Creates a directory at pathname. Note that some systems have a limit to the number of directories that can be made in one call.

Parameters

  • pathname: The path of the new directory.

Return Value

0 if the directory was successfully created, -1 otherwise. If directory creation fails, errno is set accordingly.

isdir()

Introduced in v0.2 "Firmament"

bool isdir (const char* path)

Checks to see if path is a directory.

Parameters

  • path: The path of the directory to check.

Return Value

Whether the path is a directory.

isfile()

Introduced in v0.2 "Firmament"

bool isfile (const char* path)

Checks to see if path is a file.

Parameters

  • path: The path of the file to check.

Return Value

Whether the path is a file.

getConfigDir()

Introduced in v0.2 "Firmament"

std::string getConfigDir ()

Returns an absolute path to the location where application data is stored.

Return Value

An absolute path to the application configuration directory.

Clone this wiki locally