blob: 376ab7641232a16ee6f7f2c313a776fac30caf98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* 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 <FL/filename.H>
#include <FL/fl_utf8.h>
/**
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
|