X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FPath.h;h=e7940c09da2f7b90c18f8bbc653d93fb5a24e62b;hb=f7680c696d3b62cbd289ff255a6d636eab7e096c;hp=8f78c0e3004f5ca720505e3c4855fc74338d3da9;hpb=fad47c0fe0a45da4ac4a395817a0ad73425ef275;p=lyx.git diff --git a/src/support/Path.h b/src/support/Path.h index 8f78c0e300..e7940c09da 100644 --- a/src/support/Path.h +++ b/src/support/Path.h @@ -4,7 +4,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -14,9 +14,6 @@ #include "support/FileName.h" -#include - -#include namespace lyx { namespace support { @@ -28,23 +25,28 @@ namespace support { * change to a directory as the cwd, for example : * * if (blah) { - * Path p("/tmp/blah"); + * FileName pp("/tmp/blah"); + * PathChanger p(pp); * ... * } * * At the end of p's scope the cwd is reset to its previous value. */ -class Path : boost::noncopyable { +class PathChanger { public: /// change to the given directory - explicit Path(FileName const & path); + explicit PathChanger(FileName const & path); /// set cwd to the previous value if needed - ~Path(); + ~PathChanger(); /// set cwd to the previous value if needed int pop(); private: + /// noncopyable + PathChanger(PathChanger const &); + void operator=(PathChanger const &); + /// whether we are in the new cwd or not bool popped_; /// the previous cwd @@ -52,17 +54,27 @@ private: }; // To avoid the wrong usage: -// Path("/tmp"); // wrong -// Path p("/tmp"); // right +// PathChanger("/tmp"); // wrong +// PathChanger p("/tmp"); // right // we add this macro: -/// -// With boost 1.34 this is not usable anymore -//#ifndef PATH_C -//#define Path(x) unnamed_Path; -//#endif +#define PathChanger(x) unnamed_PathChanger; // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal } // namespace support } // namespace lyx +#ifdef __APPLE__ + +#ifdef __cplusplus +extern "C" { +#endif +int getPrivateFrameworkPathName(char * buf, unsigned len, char const * framework); + +#ifdef __cplusplus +} +#endif + +#endif + + #endif // PATH_H