summaryrefslogtreecommitdiff
path: root/fluid/tools/filename.h
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/tools/filename.h')
-rw-r--r--fluid/tools/filename.h67
1 files changed, 37 insertions, 30 deletions
diff --git a/fluid/tools/filename.h b/fluid/tools/filename.h
index 85e4a2844..376ab7641 100644
--- a/fluid/tools/filename.h
+++ b/fluid/tools/filename.h
@@ -23,35 +23,42 @@
#include <FL/filename.H>
#include <FL/fl_utf8.h>
-#include <string>
-
-std::string fl_filename_shortened(const std::string &filename, int maxchars);
-
-// Wrapper functions for filename operations returning std::string
-// These are FLUID-local implementations of functions that were removed from core FLTK
-
-std::string fl_getcwd_str();
-std::string fl_filename_path_str(const char *filename);
-std::string fl_filename_path_str(const std::string &filename);
-std::string fl_filename_absolute_str(const char *from);
-std::string fl_filename_absolute_str(const std::string &from);
-std::string fl_filename_absolute_str(const char *from, const char *cwd);
-std::string fl_filename_absolute_str(const std::string &from, const std::string &cwd);
-std::string fl_filename_relative_str(const char *from);
-std::string fl_filename_relative_str(const std::string &from);
-std::string fl_filename_name_str(const char *filename);
-std::string fl_filename_name_str(const std::string &filename);
-std::string fl_filename_setext_str(const char *filename, const char *ext);
-std::string fl_filename_setext_str(const std::string &filename, const std::string &ext);
-std::string fl_filename_expand_str(const std::string &from);
-std::string fl_filename_ext_str(const char *filename);
-std::string fl_filename_ext_str(const std::string &filename);
-
-namespace fld {
-
-extern std::string end_with_slash(const std::string &fn);
-extern std::string fix_separators(const std::string &fn);
-
-} // namespace fld
+
+/**
+ 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