4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * A selection of useful system functions made
10 * \author Lars Gullik Bjønnes
12 * Full author contact details are available in file CREDITS.
18 #include "support/FileName.h"
26 /// get the current working directory
27 FileName const getcwd();
29 /// FIXME: some point to this hmm ?
30 int kill(int pid, int sig);
33 /// create the given directory with the given mode
34 /// \ret return 0 if the directory is successfully created
35 int mkdir(FileName const & pathname, unsigned long int mode);
36 /// create the given directory with the given mode, create all
37 /// intermediate directories if necessary
38 /// \ret return 0 if the directory is successfully created
39 int makedir(char * pathname, unsigned long int mode=0755);
40 /// (securely) create a temporary file in the given dir with the given mask
41 /// \p mask must be in filesystem encoding
42 FileName const tempName(FileName const & dir = FileName(),
43 std::string const & mask = std::string());
47 * Returns true if var is approximately equal to number with allowed error
50 * Usage: if (float_equal(var, number, 0.0001)) { }
52 * This will check if 'var' is approx. equal to 'number' with error of 1/1000
54 inline bool float_equal(double var, double number, double error)
56 return (number - error <= var && var <= number + error);
59 } // namespace support
62 #endif /* LYX_LIB_H */