CRelativePaths v1.05
Welcome to CRelativePaths, a C++ class to convert to and
from relative paths, This is similar to how Visual Studio stores filenames in a
project / workspace. This means that you can copy a project to a different drive
and recompile without problems.
Copyright
- You are allowed to include the source code in any product (commercial,
shareware, freeware or otherwise) when your product is released in binary
form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you
are only allowed to distribute versions released by the author. This is to
maintain a single distribution point for the source code.
History
v1.05 (15 April 2022)
- Updated copyright details.
- Updated the code to use C++ uniform initialization for all variable
declarations.
v1.04 (17 March 2020)
- Updated copyright details.
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.03 (15 December 2018)
- Updated copyright details.
- Fixed a number of C++ core guidelines compiler warnings. These changes
mean that the code will now only compile on VC 2017 or later.
- Removed code path which supported RELATIVEPATHS_MFC_EXTENSIONS
define
1 May 2017
- Updated the demo app to compile cleanly using /permissive-.
v1.02 (28 June 2015)
- Updated copyright details.
- Updated the code to clean compile on VC 2008 & later
- Updated the code to require VC 2005 or later
- Updated the code to be a header only implementation
- Reworked the RelativeToAbsolute method to return the string return value
as an output parameter instead of a return value.
- Updated the code to include SAL annotations.
- Reworked the code to optionally compile without MFC. By default the code
now use STL classes and idioms but if you define
RELATIVEPATHS_MFC_EXTENSIONS the code will revert back to the MFC behaviour.
- Removed the static critical section member variable of the
CRelativePaths class. Please note that while the RelativeToAbsolute method
is executing it is possible that code in some other thread of your app could
also be modifying the current working directory. To avoid such race
conditions you should serialize that code with the execution of
RelativeToAbsolute with something like a critical section.
v1.01 (28 December 2006)
- Updated copyright details
- Addition of a CRELATIVEPATHS_EXT_CLASS preprocessor macro to allow the
classes to be more easily added to an extension dll
- Updated the code to clean compile on VC 2005
- Updated the documentation to use the same style as the web site
v1.0 (7 April 2003)
Usage
To use the class simple #include RelPaths.h to your project.
Then you can use the 2 key functions CRelativePaths::AbsoluteToRelative and
CRelativePaths::RelativeToAbsolute in your code just like in the sample
app's module "main.cpp".
Included with the download is a very simple VC 2017 app which exercises the
functions using various legal and illegal path values.
Contacting the Author
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
15 April 2022