Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

File system

Last update: 16.07.2025

A collection of file system utility functions. More...

Functions

string canonical (string url="")
 Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements. More...
 
 copyFile (string source_url, string target_url)
 copies the specified file More...
 
 createDirectories (string url)
 creates the directory and also subdirectories if required More...
 
bool exists (string url)
 
bool isDirectory (string url)
 
bool isRegularFile (string url)
 
boost::filesystem::path relative (boost::filesystem::path from, boost::filesystem::path to)
 Get the relative path between two paths. More...
 
 removeAll (string url)
 removes the given path and its contents More...
 

Detailed Description

A collection of file system utility functions.

Function Documentation

◆ canonical()

string canonical ( string  url = "")

Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements.

Parameters
urlA string defining the path. This url might be given as absolute or relative path. A relative path starts from the current working directory. For an empty string the current working directory will be assumed
Returns
- On sucess, an absolute path that has no symbolic link, dot, or dot-dot-elements
  • If a link, dot or dot-dot resolution lookup failed for some reason, e.g. the url is given in a UNC/URI definition only the absolute path will be returned
Exceptions
-If the url simply not exists
Note
This is simply an exception safer wrapper of boost::filesystem::canoncial

◆ copyFile()

copyFile ( string  source_url,
string  target_url 
)

copies the specified file

Parameters
source_urla string defining the path of the source file
target_urla string defining the path of the target file

◆ createDirectories()

createDirectories ( string  url)

creates the directory and also subdirectories if required

Parameters
urla string defining the path to be created

◆ exists()

bool exists ( string  url)
Returns
true if the given url exists
Parameters
urla string defining the path to test

◆ isDirectory()

bool isDirectory ( string  url)
Returns
true if the given url is a directory
Parameters
urla string defining the path to test

◆ isRegularFile()

bool isRegularFile ( string  url)
Returns
true if the given url is a file
Parameters
urla string defining the path to test

◆ relative()

boost::filesystem::path relative ( boost::filesystem::path  from,
boost::filesystem::path  to 
)

Get the relative path between two paths.

Note
Works for URLs that are not existing on disk, too.
Parameters
fromThe origin path
toThe target path
Returns
A path object of the relative path.

◆ removeAll()

removeAll ( string  url)

removes the given path and its contents

Parameters
urla string defining the path to be deleted

Connect with Ansys