QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
folderutils.h File Reference

Folder utilities: common folder support functions. More...

#include "common.h"
#include <stdio.h>

Go to the source code of this file.

Enumerations

enum  qsc_folderutils_directories {
  qsc_folderutils_directories_user_app_data = 0x00U , qsc_folderutils_directories_user_desktop = 0x01U , qsc_folderutils_directories_user_documents = 0x02U , qsc_folderutils_directories_user_downloads = 0x03U ,
  qsc_folderutils_directories_user_favourites = 0x04U , qsc_folderutils_directories_user_music = 0x05U , qsc_folderutils_directories_user_pictures = 0x06U , qsc_folderutils_directories_user_programs = 0x07U ,
  qsc_folderutils_directories_user_shortcuts = 0x08U , qsc_folderutils_directories_user_videos = 0x09U
}
 The system special folders enumeration. More...
 

Functions

QSC_EXPORT_API void qsc_folderutils_append_delimiter (char path[QSC_SYSTEM_MAX_PATH])
 Append a folder path delimiter.
 
QSC_EXPORT_API bool qsc_folderutils_create_directory (const char path[QSC_SYSTEM_MAX_PATH])
 Create a new folder.
 
QSC_EXPORT_API bool qsc_folderutils_delete_directory (const char path[QSC_SYSTEM_MAX_PATH])
 Delete a folder.
 
QSC_EXPORT_API bool qsc_folderutils_directory_exists (const char path[QSC_SYSTEM_MAX_PATH])
 Check if a folder exists.
 
QSC_EXPORT_API size_t qsc_folderutils_directory_list (char *result, size_t reslen, const char *directory)
 Write a list of directories to a string, delineated by newline characters.
 
QSC_EXPORT_API void qsc_folderutils_get_directory (qsc_folderutils_directories directory, char output[QSC_SYSTEM_MAX_PATH])
 Get the full path to a special system folder.
 
QSC_EXPORT_API bool qsc_folderutils_directory_has_delimiter (const char path[QSC_SYSTEM_MAX_PATH])
 Check if the folder path ends in a delimiter.
 

Detailed Description

Folder utilities: common folder support functions.

This file provides a suite of functions for performing operations on folders such as:

  • Appending a folder delimiter to a path.
  • Creating and deleting directories.
  • Checking for the existence of a folder.
  • Listing files within a directory.
  • Retrieving the full path to a special system folder.
// Example: Creating a new directory
if (qsc_folder_create("C:\\NewFolder") == true) {
// Folder successfully created.
}

Reference Links:

Enumeration Type Documentation

◆ qsc_folderutils_directories

The system special folders enumeration.

Enumerator
qsc_folderutils_directories_user_app_data 

User App Data directory.

qsc_folderutils_directories_user_desktop 

User Desktop directory.

qsc_folderutils_directories_user_documents 

User Documents directory.

qsc_folderutils_directories_user_downloads 

User Downloads directory.

qsc_folderutils_directories_user_favourites 

User Favourites directory.

qsc_folderutils_directories_user_music 

User Music directory.

qsc_folderutils_directories_user_pictures 

User Pictures directory.

qsc_folderutils_directories_user_programs 

User Programs directory.

qsc_folderutils_directories_user_shortcuts 

User Shortcuts directory.

qsc_folderutils_directories_user_videos 

User Video directory.

Function Documentation

◆ qsc_folderutils_append_delimiter()

QSC_EXPORT_API void qsc_folderutils_append_delimiter ( char path[QSC_SYSTEM_MAX_PATH])

Append a folder path delimiter.

Appends a directory delimiter to the provided path string if it is not already present.

Parameters
path[char*] The full path including the new folder name.

◆ qsc_folderutils_create_directory()

QSC_EXPORT_API bool qsc_folderutils_create_directory ( const char path[QSC_SYSTEM_MAX_PATH])

Create a new folder.

Creates a directory at the specified path.

Parameters
path[const char*] The full path including the new folder name.
Returns
[bool] Returns true if the folder is created.

◆ qsc_folderutils_delete_directory()

QSC_EXPORT_API bool qsc_folderutils_delete_directory ( const char path[QSC_SYSTEM_MAX_PATH])

Delete a folder.

Deletes the directory at the specified path.

Parameters
path[const char*] The full path including the folder name.
Returns
[bool] Returns true if the folder is deleted.

◆ qsc_folderutils_directory_exists()

QSC_EXPORT_API bool qsc_folderutils_directory_exists ( const char path[QSC_SYSTEM_MAX_PATH])

Check if a folder exists.

Checks whether the specified folder exists.

Parameters
path[const char*] The full path including the folder name.
Returns
[bool] Returns true if the folder is found.

◆ qsc_folderutils_directory_has_delimiter()

QSC_EXPORT_API bool qsc_folderutils_directory_has_delimiter ( const char path[QSC_SYSTEM_MAX_PATH])

Check if the folder path ends in a delimiter.

Determines whether the provided folder path string ends with a directory delimiter.

Parameters
path[const char*] The full path including the folder name.
Returns
[bool] Returns true if the folder path ends with a delimiter.

◆ qsc_folderutils_directory_list()

QSC_EXPORT_API size_t qsc_folderutils_directory_list ( char * result,
size_t reslen,
const char * directory )

Write a list of directories to a string, delineated by newline characters.

Constructs a string listing the directories within the specified starting directory.

Parameters
result[char*] The output result string.
reslen[size_t] The length of the output string buffer.
directory[const char*] The starting directory.
Returns
[size_t] Returns the length of the output string.

◆ qsc_folderutils_get_directory()

QSC_EXPORT_API void qsc_folderutils_get_directory ( qsc_folderutils_directories directory,
char output[QSC_SYSTEM_MAX_PATH] )

Get the full path to a special system folder.

Retrieves the full directory path corresponding to the given special folder enumeration.

Parameters
directory[qsc_folderutils_directories] The enum value of the system folder.
output[char*] The output string containing the directory path.