-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set kRootDir for FlagValue::CleanName #86
Comments
Could you explain, what is it for? |
Well, I am not so clear about it's purpose myself. From what I could tell, it is not possible to actually set this variable neither at runtime nor compile time of a client program. If I remember correctly, I've opened this issue myself to look into it some day and possibly come up with a way that a project that uses |
Is it possible to do something like this: extern gflags::CommandLineFlag::CleanFileName::kRootDir;
int main()
{
gflags::CommandLineFlag::CleanFileName::kRootDir = "foo";
} ?!? I would think not, but that'd be the only way to set it. Possibly this variable was a real global variable at some point, but then made local static variable for some reason to "disable" this functionality.... I have no idea as I was not involved with the project when these changes/decisions were made. |
Nope, it isn't possible. If we need a way to set
Maybe we should create another one for RootDir. |
Yes, I guess a sensible thing to do would be to add functions in the style of the static string kRootDir = "";
void SetRootDir(const string &path)
{
kRootDir = path;
}
const char *RootDir()
{
return kRootDir.c_str();
} The reason these might not be present at the moment could be that unless it is clear how it should be used and how useful it is, there shouldn't be an addition to the public API unless we are clear about this new feature. A question would be how to accommodate different root directories for flags defined in different shared libraries which may not be built by the same person. The But I guess if the creator of a shared library would want the file paths to be stripped off a certain build directory prefix, there could (in the future) be a way to modify directly the |
Should this be closed, since kRootDir was removed? |
Fine by me. |
Original issue 75 created by schuhschuh on 2014-03-20T16:12:02.000Z:
The kRootDir is a static variable in the body of the CleanName function which strips of a common path prefix from all C++ module file paths. I am wondering how this static variable can be overridden by a global variable.
The text was updated successfully, but these errors were encountered: