winIDEA SDK
|
This class converts paths between native Linux paths and paths in winIDEA domain, for example WINE paths.
It provides interface of a singleton pattern, so you may initialize it only once. However, ctors are public to enable creating custom instances for complex use cases, for example controlling two winIDEAs in different environments.
Typical usage:
auto pt = isys::PathTransformer::get_instance();
This will provide you with an instance properly initialized in the following cases:
For other use cases, you have to initialize the instance:
pt->init(client_env, winidea_env);
#include <PathTransformer.h>
Public Member Functions | |
void | init (isys::SOSVersion eSourceOS, isys::SOSVersion eWinIDEAOs) |
Initializes instance with the given parameters. | |
PathTransformer () | |
Creates object with default settings. | |
PathTransformer (isys::SOSVersion eSourceOS, isys::SOSVersion eWinIDEAOs) | |
Creates object with the given parameters. | |
std::string | to_host_path (const std::string &winidea_path, bool is_relative_to_winidea=true) |
Reverse as PathTransformer::to_winidea_path(). | |
std::string | to_winidea_path (const std::string &host_path, bool is_relative_to_winidea=true) |
Converts host path to winIDEA path. | |
std::string | winepath (const std::string &input, EConvDirection direction) |
This function implements functionality of the winepath utility. | |
Static Public Member Functions | |
static std::shared_ptr< PathTransformer > | get_instance () |
Returns singleton instance. | |
|
inline |
Creates object with default settings.
See class description for more details.
|
inline |
Creates object with the given parameters.
eSourceOS | environment where client app (the app using winIDEA SDK) is running |
eWinIDEAOs | environment where winIDEA is running |
|
static |
Returns singleton instance.
When this method is called for the first time, the instance is created with default parameters. See class description for more details on default parameters.
|
inline |
Initializes instance with the given parameters.
This overrides settings given in ctor.
eSourceOS | environment where client app (the app using winIDEA SDK) is running |
eWinIDEAOs | environment where winIDEA is running |
std::string isys::PathTransformer::to_host_path | ( | const std::string & | winidea_path, |
bool | is_relative_to_winidea = true ) |
Reverse as PathTransformer::to_winidea_path().
winidea_path | path in winIDEA environment (for example WINE path) |
is_relative_to_winidea | if true, relative path to winIDEA workspace is assumed, the path is left intact, only path separators are replaced if necessary |
std::string isys::PathTransformer::to_winidea_path | ( | const std::string & | host_path, |
bool | is_relative_to_winidea = true ) |
Converts host path to winIDEA path.
It checks values of host and winIDEA environment set in ctor and then calls appropriate path conversion functions when environments are different.
If you call this method with path in winIDEA environment, the result will be invalid path.
host_path | path in client environment (app using winIDEA SDK) |
is_relative_to_winidea | if false, relative to cwd is assumed, otherwise, relative paths are not processed. |
std::string isys::PathTransformer::winepath | ( | const std::string & | input, |
EConvDirection | direction ) |
This function implements functionality of the winepath
utility.
input | string path representation to be converted |
direction | conversion direction wine->unix or unix->wine |