/* * Filename handling header file for the Fast Light Tool Kit (FLTK). * * Copyright 1998-2025 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /** \file fluid/filename.h \brief Handling file names operations that are not in the core library. */ #ifndef FLUID_TOOLS_FILENAME_H #define FLUID_TOOLS_FILENAME_H #include #include /** Return a shortened filename for limited display width. Replaces path start with "~" if it matches home directory, and shortens middle with "..." if needed. \param[out] result buffer to store result \param[in] result_size size of result buffer \param[in] filename absolute path and name, UTF-8 aware \param[in] max_chars maximum number of characters in result \return pointer to result buffer */ char *fl_filename_shortened(char *result, int result_size, const char *filename, int max_chars); /** Get path component (directory) from a filename. \param[out] result buffer to store result (ends with separator) \param[in] result_size size of result buffer \param[in] filename the full path \return pointer to result buffer */ char *fl_filename_path(char *result, int result_size, const char *filename); /** Make sure that a path name ends with a forward slash. \param[out] result buffer to store result \param[in] result_size size of result buffer \param[in] path directory or path name \return pointer to result buffer */ char *fld_end_with_slash(char *result, int result_size, const char *path); /** Replace Windows '\\' directory separator with Unix '/' separators in-place. \param[in,out] path a file path to modify \return pointer to path */ char *fld_fix_separators(char *path); #endif // FLUID_TOOLS_FILENAME_H