-
Notifications
You must be signed in to change notification settings - Fork 466
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
DRAFT: Improved FSW symlink handling #3550
DRAFT: Improved FSW symlink handling #3550
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea. Like you said, we should probably make this a configuration somewhere in the UI. Also, maybe using FileUtils which is more recent than globals.cpp
@@ -937,10 +939,14 @@ wxFileName wxReadLink(const wxFileName& filename) | |||
#endif | |||
} | |||
|
|||
wxString CLRealPath(const wxString& filepath) // This is readlink on steroids: it also makes-absolute, and dereferences | |||
wxString CLRealPath(const wxString& filepath, bool force) // This is readlink on steroids: it also makes-absolute, and dereferences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably move this logic into FileUtils
// any symlinked dirs in the path | ||
{ | ||
return FileUtils::RealPath(filepath); | ||
if (force || pEnv_CL_RealPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this a static variable inside FileUtils
makes more sense
5237931
to
24e6479
Compare
Thanks for your feed back - good to know :-) |
24e6479
to
70e6213
Compare
Just a question: Would you prefer an implementation that calls FileUtils::RealPath() (or similar) over CLRealPath() ? |
It's current logic (before your change) is simply this: return FileUtils::RealPath(filepath); |
059b203
to
253422f
Compare
FYI: the CI is consistently failing with missing symbols. Maybe you forgot to add a file to git? |
253422f
to
299488d
Compare
Thanks - I'll close this draft while doing rework |
DRAFT: Improved FSW symlink handling
This is NOT a real PR - it is only meant for discussion
In continuation of our talk on issue #3544
I've for more than 2 years used/applied this patch on top of CodeLite
This patch enables me to use CodeLite on projects that have symlinks in the path leading up to the FSW project root.
There are several problems in respect to symlinks and the use of realpath() calls that this patch approaches:
WorkspaceRealPath
#3544This patch have worked for me without any problems for more than 2 years.
It basically fakes the use of CLRealPath() calls - on most occasions just returning the unmodified path.
An optional argument to CLRealPath() (defaults to false) can force the realpath() conversion (this is only used in very few occasions in my patch)
For compatibility reasons (and easy testing) the original behavior of CLRealPath() can be reestablished/reenabled by starting CodeLite with the environment variable
CL_REALPATH
defined.eg:
I've used this handle to do extensive testing of this feature - it makes it easy to compare behavior with or without the realpath manipulation - and hence evaluate the end-user experience of the functionality of this patch.
My plan was to make a CL GUI option within the FSW project configuration for "FSW symlink/realpath handling" - so that end-users would be able to enable/disable this feature based on their project setup (just for compatibilty - as there may be some scenarios that I haven't thought of)
Anyway - I've not yet come around to make as GUI option for this - mainly because the patch as-is solves all my personal issues with FSW projects and symlinks
This is just meant to inspire you to how FSW symlink handling can easily be improved - see it as a starting-point for a discussion
At some point I hope that this patch or similar functionality can be included into CodeLite :-)