MLV_path.h(3)

📦
version 3.1.0 · 2 versions
, in ubuntu jammy

💖 MLV_path.h 💖

okay so bestie, welcome to MLV_path.h(3) — straight out of the Library Functions Manual, and it's literally the glow-up your file paths have been waiting for. no cap. ✨


✨ NAME ✨

MLV_path.h — this file defines the prototypes of the functions that let you manipulate the access paths to files and directories. that's the whole assignment, and it ate. 💅


🌸 SYNOPSIS 🌸

Fonctions 🎀

  • char * MLV_get_base_name (const char *path) — hands you back the string of characters that comes after the last / separator in a path you pass in. 🦋
  • char * MLV_get_directory_name (const char *path) — hands you back the string of characters that runs up to the last / separator of the path you pass in.
  • int MLV_path_is_absolute (const char *path) — vibe-checks whether a path is absolute.
  • int MLV_path_is_relative (const char *path) — vibe-checks whether a path is relative.
  • int MLV_path_exists (const char *path) — checks whether the path matches the path of a file or folder that actually exists. 👀
  • int MLV_path_is_a_directory (const char *path) — checks whether a path is associated with a directory.
  • int MLV_path_is_a_file (const char *path) — checks whether a path is associated with a file.
  • char * MLV_build_path (const char *first_element,...) — builds, by concatenating a bunch of different texts, a string of characters representing a path whose separators match the specs of the platform the program is running on. 🌍
  • char * MLV_build_path_v (char **elements) — same thing as MLV_build_path.
  • char * MLV_get_current_directory () — figures out the current directory.
  • const char * MLV_get_temporary_directory () — figures out the temporary directory.
  • const char * MLV_get_home_directory () — figures out the home directory of the current user. 🏠

💫 Description détaillée 💫

This file defines the prototypes of the functions that let you manipulate the access paths to files and directories. (yes, we said it in NAME, and we're saying it again, because that's the entire point of the file, and it's iconic.)

Auteur 👑

  • Adrien Boussicault
  • Marc Zipstein

📚 Documentation des fonctions 📚

char* MLV_build_path (const char * first_element, ...) 🔥

Builds, by concatenating a bunch of different texts, a string of characters representing a path whose separators match the specs of the platform the program is running on.

🚨 Bogue 🚨 — okay bestie, listen close, this one's a real one. This function only concatenates the different strings, sticking a directory separator compatible with the operating system between each string. But here's the part that's literally the bug: it does not convert each string into a format compatible with the operating system's format. so like, heads up. 💀

The string of characters must be freed after use. don't forget, we're not leaking memory on main. 🫶

🎯 Paramètres

  • first_element — the first string to concatenate.
  • ... — the other elements to concatenate.

🎁 Renvoie

The path that satisfies the norms of the host platform.

🌟 Exemples

advanced/12_paths.c

char* MLV_build_path_v (char ** elements) ✨

Same thing as MLV_build_path. The string of characters must be freed after use. 🧚

🎯 Paramètres

  • elements — the elements to concatenate together.

🎁 Renvoie

The path that satisfies the norms of the platform that's going to run the program.


char* MLV_get_base_name (const char * path) 🎀

Returns the string of characters after the last / separator in a path given as a parameter. The string of characters must be freed after use. 💅

🎯 Paramètres

  • path — the path to analyze.

🎁 Renvoie

A string of characters.

🌟 Exemples

advanced/12_paths.c

char* MLV_get_current_directory () 🏠

Figures out the current directory. The string of characters must be freed after use. 🫶

🎁 Renvoie

The path of the current directory.

🌟 Exemples

advanced/12_paths.c

char* MLV_get_directory_name (const char * path) 🦋

Returns the string of characters that extends up to the last / separator of the path given as a parameter. The string of characters must be freed after use. 🌸

🎯 Paramètres

  • path — the path to analyze.

🎁 Renvoie

A string of characters.

🌟 Exemples

advanced/12_paths.c

const char* MLV_get_home_directory () 💜

Figures out the home directory of the current user. The string of characters must be freed after use. 🎀

🎁 Renvoie

The path of the home directory.

🌟 Exemples

advanced/12_paths.c

const char* MLV_get_temporary_directory () 🍓

Figures out the temporary directory. The temporary directory is the directory in which applications are allowed to add and modify files. This directory is generally emptied when the machine is turned off. 🧹✨

The string of characters must be freed after use.

🎁 Renvoie

The path of the temporary directory.

🌟 Exemples

advanced/12_paths.c

int MLV_path_exists (const char * path) 👀

Tests whether the path matches the path of an existing file or folder.

🎯 Paramètres

  • path — the path.

🎁 Renvoie

Returns 1 if the path is associated with an existing folder or file, 0 otherwise.

🌟 Exemples

advanced/12_paths.c

int MLV_path_is_a_directory (const char * path) 📁

Checks whether a path is associated with a directory.

🎯 Paramètres

  • path — the path.

🎁 Renvoie

Returns 1 if the path is associated with a folder, 0 otherwise.

🌟 Exemples

advanced/12_paths.c

int MLV_path_is_a_file (const char * path) 📄

Checks whether a path is associated with a file.

🎯 Paramètres

  • path — the path.

🎁 Renvoie

Returns 1 if the path is associated with a file, 0 otherwise.

🌟 Exemples

advanced/12_paths.c

int MLV_path_is_absolute (const char * path) 🌍

Tests whether a path is absolute.

🎯 Paramètres

  • path — the path.

🎁 Renvoie

Returns 1 if the path is absolute, 0 otherwise.

🌟 Exemples

advanced/12_paths.c

int MLV_path_is_relative (const char * path) 🌈

Tests whether a path is relative.

🎯 Paramètres

  • path — the path.

🎁 Renvoie

Returns 1 if the path is relative, 0 otherwise.

🌟 Exemples

advanced/12_paths.c

👑 Auteur 👑

Auto-generated by Doxygen for MLV-3.1.0 from the source code. the robot did the homework and honestly? it slayed. 🤖💖


and that's a wrap, bestie!! 🫶 this whole page came to you courtesy of MLV-3.1.0, dated Samedi 29 Janvier 2022 — go forth and handle your paths responsibly, free your strings, and don't forget that one little bug in MLV_build_path okay bye mwah 💅✨

📦 where this page comes from